diff --git a/node_modules/.bin/mathjs b/node_modules/.bin/mathjs new file mode 100644 index 0000000..302bad5 --- /dev/null +++ b/node_modules/.bin/mathjs @@ -0,0 +1,16 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../mathjs/bin/cli.js" "$@" +else + exec node "$basedir/../mathjs/bin/cli.js" "$@" +fi diff --git a/node_modules/.bin/mathjs.cmd b/node_modules/.bin/mathjs.cmd new file mode 100644 index 0000000..b8c2962 --- /dev/null +++ b/node_modules/.bin/mathjs.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\mathjs\bin\cli.js" %* diff --git a/node_modules/.bin/mathjs.ps1 b/node_modules/.bin/mathjs.ps1 new file mode 100644 index 0000000..98edaeb --- /dev/null +++ b/node_modules/.bin/mathjs.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../mathjs/bin/cli.js" $args + } else { + & "$basedir/node$exe" "$basedir/../mathjs/bin/cli.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../mathjs/bin/cli.js" $args + } else { + & "node$exe" "$basedir/../mathjs/bin/cli.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index 37c1d36..cbe1c05 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -3,10 +3,104 @@ "lockfileVersion": 3, "requires": true, "packages": { + "node_modules/@babel/runtime": { + "version": "7.26.0", + "resolved": "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.26.0.tgz", + "integrity": "sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==", + "dependencies": { + "regenerator-runtime": "^0.14.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/complex.js": { + "version": "2.4.2", + "resolved": "https://registry.npmmirror.com/complex.js/-/complex.js-2.4.2.tgz", + "integrity": "sha512-qtx7HRhPGSCBtGiST4/WGHuW+zeaND/6Ld+db6PbrulIB1i2Ev/2UPiqcmpQNPSyfBKraC0EOvOKCB5dGZKt3g==", + "engines": { + "node": "*" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/rawify" + } + }, + "node_modules/decimal.js": { + "version": "10.4.3", + "resolved": "https://registry.npmmirror.com/decimal.js/-/decimal.js-10.4.3.tgz", + "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==" + }, + "node_modules/escape-latex": { + "version": "1.2.0", + "resolved": "https://registry.npmmirror.com/escape-latex/-/escape-latex-1.2.0.tgz", + "integrity": "sha512-nV5aVWW1K0wEiUIEdZ4erkGGH8mDxGyxSeqPzRNtWP7ataw+/olFObw7hujFWlVjNsaDFw5VZ5NzVSIqRgfTiw==" + }, + "node_modules/fraction.js": { + "version": "5.2.1", + "resolved": "https://registry.npmmirror.com/fraction.js/-/fraction.js-5.2.1.tgz", + "integrity": "sha512-Ah6t/7YCYjrPUFUFsOsRLMXAdnYM+aQwmojD2Ayb/Ezr82SwES0vuyQ8qZ3QO8n9j7W14VJuVZZet8U3bhSdQQ==", + "engines": { + "node": ">= 12" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/rawify" + } + }, + "node_modules/javascript-natural-sort": { + "version": "0.7.1", + "resolved": "https://registry.npmmirror.com/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz", + "integrity": "sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw==" + }, + "node_modules/mathjs": { + "version": "14.0.1", + "resolved": "https://registry.npmmirror.com/mathjs/-/mathjs-14.0.1.tgz", + "integrity": "sha512-yyJgLwC6UXuve724np8tHRMYaTtb5UqiOGQkjwbSXgH8y1C/LcJ0pvdNDZLI2LT7r+iExh2Y5HwfAY+oZFtGIQ==", + "dependencies": { + "@babel/runtime": "^7.25.7", + "complex.js": "^2.2.5", + "decimal.js": "^10.4.3", + "escape-latex": "^1.2.0", + "fraction.js": "^5.2.1", + "javascript-natural-sort": "^0.7.1", + "seedrandom": "^3.0.5", + "tiny-emitter": "^2.1.0", + "typed-function": "^4.2.1" + }, + "bin": { + "mathjs": "bin/cli.js" + }, + "engines": { + "node": ">= 18" + } + }, "node_modules/mitt": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz", "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==" + }, + "node_modules/regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" + }, + "node_modules/seedrandom": { + "version": "3.0.5", + "resolved": "https://registry.npmmirror.com/seedrandom/-/seedrandom-3.0.5.tgz", + "integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==" + }, + "node_modules/tiny-emitter": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/tiny-emitter/-/tiny-emitter-2.1.0.tgz", + "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==" + }, + "node_modules/typed-function": { + "version": "4.2.1", + "resolved": "https://registry.npmmirror.com/typed-function/-/typed-function-4.2.1.tgz", + "integrity": "sha512-EGjWssW7Tsk4DGfE+5yluuljS1OGYWiI1J6e8puZz9nTMM51Oug8CD5Zo4gWMsOhq5BI+1bF+rWTm4Vbj3ivRA==", + "engines": { + "node": ">= 18" + } } } } diff --git a/node_modules/@babel/runtime/package.json b/node_modules/@babel/runtime/package.json index 3c0c2ad..8c63ca1 100644 --- a/node_modules/@babel/runtime/package.json +++ b/node_modules/@babel/runtime/package.json @@ -1,44 +1,21 @@ { - "_from": "@babel/runtime@^7.25.7", - "_id": "@babel/runtime@7.26.0", - "_inBundle": false, - "_integrity": "sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==", - "_location": "/@babel/runtime", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "@babel/runtime@^7.25.7", - "name": "@babel/runtime", - "escapedName": "@babel%2fruntime", - "scope": "@babel", - "rawSpec": "^7.25.7", - "saveSpec": null, - "fetchSpec": "^7.25.7" + "name": "@babel/runtime", + "version": "7.26.0", + "description": "babel's modular runtime helpers", + "license": "MIT", + "publishConfig": { + "access": "public" }, - "_requiredBy": [ - "/mathjs" - ], - "_resolved": "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.26.0.tgz", - "_shasum": "8600c2f595f277c60815256418b85356a65173c1", - "_spec": "@babel/runtime@^7.25.7", - "_where": "D:\\jiangchengfeiyi-xiaochengxu\\node_modules\\mathjs", - "author": { - "name": "The Babel Team", - "url": "https://babel.dev/team" + "repository": { + "type": "git", + "url": "https://github.com/babel/babel.git", + "directory": "packages/babel-runtime" }, - "bugs": { - "url": "https://github.com/babel/babel/issues" - }, - "bundleDependencies": false, + "homepage": "https://babel.dev/docs/en/next/babel-runtime", + "author": "The Babel Team (https://babel.dev/team)", "dependencies": { "regenerator-runtime": "^0.14.0" }, - "deprecated": false, - "description": "babel's modular runtime helpers", - "engines": { - "node": ">=6.9.0" - }, "exports": { "./helpers/OverloadYield": [ { @@ -1072,17 +1049,8 @@ "./regenerator/*.js": "./regenerator/*.js", "./regenerator/": "./regenerator/" }, - "homepage": "https://babel.dev/docs/en/next/babel-runtime", - "license": "MIT", - "name": "@babel/runtime", - "publishConfig": { - "access": "public" + "engines": { + "node": ">=6.9.0" }, - "repository": { - "type": "git", - "url": "git+https://github.com/babel/babel.git", - "directory": "packages/babel-runtime" - }, - "type": "commonjs", - "version": "7.26.0" -} + "type": "commonjs" +} \ No newline at end of file diff --git a/node_modules/complex.js/dist/complex.js b/node_modules/complex.js/dist/complex.js new file mode 100644 index 0000000..97b8e41 --- /dev/null +++ b/node_modules/complex.js/dist/complex.js @@ -0,0 +1,1413 @@ +'use strict'; + +/** + * + * This class allows the manipulation of complex numbers. + * You can pass a complex number in different formats. Either as object, double, string or two integer parameters. + * + * Object form + * { re: , im: } + * { arg: , abs: } + * { phi: , r: } + * + * Array / Vector form + * [ real, imaginary ] + * + * Double form + * 99.3 - Single double value + * + * String form + * '23.1337' - Simple real number + * '15+3i' - a simple complex number + * '3-i' - a simple complex number + * + * Example: + * + * const c = new Complex('99.3+8i'); + * c.mul({r: 3, i: 9}).div(4.9).sub(3, 2); + * + */ + + +const cosh = Math.cosh || function (x) { + return Math.abs(x) < 1e-9 ? 1 - x : (Math.exp(x) + Math.exp(-x)) * 0.5; +}; + +const sinh = Math.sinh || function (x) { + return Math.abs(x) < 1e-9 ? x : (Math.exp(x) - Math.exp(-x)) * 0.5; +}; + +/** + * Calculates cos(x) - 1 using Taylor series if x is small (-¼π ≤ x ≤ ¼π). + * + * @param {number} x + * @returns {number} cos(x) - 1 + */ +const cosm1 = function (x) { + + const b = Math.PI / 4; + if (-b > x || x > b) { + return Math.cos(x) - 1.0; + } + + /* Calculate horner form of polynomial of taylor series in Q + let fac = 1, alt = 1, pol = {}; + for (let i = 0; i <= 16; i++) { + fac*= i || 1; + if (i % 2 == 0) { + pol[i] = new Fraction(1, alt * fac); + alt = -alt; + } + } + console.log(new Polynomial(pol).toHorner()); // (((((((1/20922789888000x^2-1/87178291200)x^2+1/479001600)x^2-1/3628800)x^2+1/40320)x^2-1/720)x^2+1/24)x^2-1/2)x^2+1 + */ + + const xx = x * x; + return xx * ( + xx * ( + xx * ( + xx * ( + xx * ( + xx * ( + xx * ( + xx / 20922789888000 + - 1 / 87178291200) + + 1 / 479001600) + - 1 / 3628800) + + 1 / 40320) + - 1 / 720) + + 1 / 24) + - 1 / 2); +}; + +const hypot = function (x, y) { + + x = Math.abs(x); + y = Math.abs(y); + + // Ensure `x` is the larger value + if (x < y) [x, y] = [y, x]; + + // If both are below the threshold, use straightforward Pythagoras + if (x < 1e8) return Math.sqrt(x * x + y * y); + + // For larger values, scale to avoid overflow + y /= x; + return x * Math.sqrt(1 + y * y); +}; + +const parser_exit = function () { + throw SyntaxError('Invalid Param'); +}; + +/** + * Calculates log(sqrt(a^2+b^2)) in a way to avoid overflows + * + * @param {number} a + * @param {number} b + * @returns {number} + */ +function logHypot(a, b) { + + const _a = Math.abs(a); + const _b = Math.abs(b); + + if (a === 0) { + return Math.log(_b); + } + + if (b === 0) { + return Math.log(_a); + } + + if (_a < 3000 && _b < 3000) { + return Math.log(a * a + b * b) * 0.5; + } + + /* I got 4 ideas to compute this property without overflow: + * + * Testing 1000000 times with random samples for a,b ∈ [1, 1000000000] against a big decimal library to get an error estimate + * + * 1. Only eliminate the square root: (OVERALL ERROR: 3.9122483030951116e-11) + + Math.log(a * a + b * b) / 2 + + * + * + * 2. Try to use the non-overflowing pythagoras: (OVERALL ERROR: 8.889760039210159e-10) + + const fn = function(a, b) { + a = Math.abs(a); + b = Math.abs(b); + let t = Math.min(a, b); + a = Math.max(a, b); + t = t / a; + + return Math.log(a) + Math.log(1 + t * t) / 2; + }; + + * 3. Abuse the identity cos(atan(y/x) = x / sqrt(x^2+y^2): (OVERALL ERROR: 3.4780178737037204e-10) + + Math.log(a / Math.cos(Math.atan2(b, a))) + + * 4. Use 3. and apply log rules: (OVERALL ERROR: 1.2014087502620896e-9) + + Math.log(a) - Math.log(Math.cos(Math.atan2(b, a))) + + */ + + a = a * 0.5; + b = b * 0.5; + + return 0.5 * Math.log(a * a + b * b) + Math.LN2; +} + +const P = { 're': 0, 'im': 0 }; +const parse = function (a, b) { + + const z = P; + + if (a === undefined || a === null) { + z['re'] = + z['im'] = 0; + } else if (b !== undefined) { + z['re'] = a; + z['im'] = b; + } else + switch (typeof a) { + + case 'object': + + if ('im' in a && 're' in a) { + z['re'] = a['re']; + z['im'] = a['im']; + } else if ('abs' in a && 'arg' in a) { + if (!isFinite(a['abs']) && isFinite(a['arg'])) { + return Complex['INFINITY']; + } + z['re'] = a['abs'] * Math.cos(a['arg']); + z['im'] = a['abs'] * Math.sin(a['arg']); + } else if ('r' in a && 'phi' in a) { + if (!isFinite(a['r']) && isFinite(a['phi'])) { + return Complex['INFINITY']; + } + z['re'] = a['r'] * Math.cos(a['phi']); + z['im'] = a['r'] * Math.sin(a['phi']); + } else if (a.length === 2) { // Quick array check + z['re'] = a[0]; + z['im'] = a[1]; + } else { + parser_exit(); + } + break; + + case 'string': + + z['im'] = /* void */ + z['re'] = 0; + + const tokens = a.replace(/_/g, '') + .match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g); + let plus = 1; + let minus = 0; + + if (tokens === null) { + parser_exit(); + } + + for (let i = 0; i < tokens.length; i++) { + + const c = tokens[i]; + + if (c === ' ' || c === '\t' || c === '\n') { + /* void */ + } else if (c === '+') { + plus++; + } else if (c === '-') { + minus++; + } else if (c === 'i' || c === 'I') { + + if (plus + minus === 0) { + parser_exit(); + } + + if (tokens[i + 1] !== ' ' && !isNaN(tokens[i + 1])) { + z['im'] += parseFloat((minus % 2 ? '-' : '') + tokens[i + 1]); + i++; + } else { + z['im'] += parseFloat((minus % 2 ? '-' : '') + '1'); + } + plus = minus = 0; + + } else { + + if (plus + minus === 0 || isNaN(c)) { + parser_exit(); + } + + if (tokens[i + 1] === 'i' || tokens[i + 1] === 'I') { + z['im'] += parseFloat((minus % 2 ? '-' : '') + c); + i++; + } else { + z['re'] += parseFloat((minus % 2 ? '-' : '') + c); + } + plus = minus = 0; + } + } + + // Still something on the stack + if (plus + minus > 0) { + parser_exit(); + } + break; + + case 'number': + z['im'] = 0; + z['re'] = a; + break; + + default: + parser_exit(); + } + + if (isNaN(z['re']) || isNaN(z['im'])) { + // If a calculation is NaN, we treat it as NaN and don't throw + //parser_exit(); + } + + return z; +}; + +/** + * @constructor + * @returns {Complex} + */ +function Complex(a, b) { + + if (!(this instanceof Complex)) { + return new Complex(a, b); + } + + const z = parse(a, b); + + this['re'] = z['re']; + this['im'] = z['im']; +} + +Complex.prototype = { + + 're': 0, + 'im': 0, + + /** + * Calculates the sign of a complex number, which is a normalized complex + * + * @returns {Complex} + */ + 'sign': function () { + + const abs = hypot(this['re'], this['im']); + + return new Complex( + this['re'] / abs, + this['im'] / abs); + }, + + /** + * Adds two complex numbers + * + * @returns {Complex} + */ + 'add': function (a, b) { + + const z = parse(a, b); + + const tInfin = this['isInfinite'](); + const zInfin = !(isFinite(z['re']) && isFinite(z['im'])); + + if (tInfin || zInfin) { + + if (tInfin && zInfin) { + // Infinity + Infinity = NaN + return Complex['NAN']; + } + // Infinity + z = Infinity { where z != Infinity } + return Complex['INFINITY']; + } + + return new Complex( + this['re'] + z['re'], + this['im'] + z['im']); + }, + + /** + * Subtracts two complex numbers + * + * @returns {Complex} + */ + 'sub': function (a, b) { + + const z = parse(a, b); + + const tInfin = this['isInfinite'](); + const zInfin = !(isFinite(z['re']) && isFinite(z['im'])); + + if (tInfin || zInfin) { + + if (tInfin && zInfin) { + // Infinity - Infinity = NaN + return Complex['NAN']; + } + // Infinity - z = Infinity { where z != Infinity } + return Complex['INFINITY']; + } + + return new Complex( + this['re'] - z['re'], + this['im'] - z['im']); + }, + + /** + * Multiplies two complex numbers + * + * @returns {Complex} + */ + 'mul': function (a, b) { + + const z = parse(a, b); + + const tInfin = this['isInfinite'](); + const zInfin = !(isFinite(z['re']) && isFinite(z['im'])); + const tIsZero = this['re'] === 0 && this['im'] === 0; + const zIsZero = z['re'] === 0 && z['im'] === 0; + + // Infinity * 0 = NaN + if (tInfin && zIsZero || zInfin && tIsZero) { + return Complex['NAN']; + } + + // Infinity * z = Infinity { where z != 0 } + if (tInfin || zInfin) { + return Complex['INFINITY']; + } + + // Shortcut for real values + if (z['im'] === 0 && this['im'] === 0) { + return new Complex(this['re'] * z['re'], 0); + } + + return new Complex( + this['re'] * z['re'] - this['im'] * z['im'], + this['re'] * z['im'] + this['im'] * z['re']); + }, + + /** + * Divides two complex numbers + * + * @returns {Complex} + */ + 'div': function (a, b) { + + const z = parse(a, b); + + const tInfin = this['isInfinite'](); + const zInfin = !(isFinite(z['re']) && isFinite(z['im'])); + const tIsZero = this['re'] === 0 && this['im'] === 0; + const zIsZero = z['re'] === 0 && z['im'] === 0; + + // 0 / 0 = NaN and Infinity / Infinity = NaN + if (tIsZero && zIsZero || tInfin && zInfin) { + return Complex['NAN']; + } + + // Infinity / 0 = Infinity + if (zIsZero || tInfin) { + return Complex['INFINITY']; + } + + // 0 / Infinity = 0 + if (tIsZero || zInfin) { + return Complex['ZERO']; + } + + if (0 === z['im']) { + // Divisor is real + return new Complex(this['re'] / z['re'], this['im'] / z['re']); + } + + if (Math.abs(z['re']) < Math.abs(z['im'])) { + + const x = z['re'] / z['im']; + const t = z['re'] * x + z['im']; + + return new Complex( + (this['re'] * x + this['im']) / t, + (this['im'] * x - this['re']) / t); + + } else { + + const x = z['im'] / z['re']; + const t = z['im'] * x + z['re']; + + return new Complex( + (this['re'] + this['im'] * x) / t, + (this['im'] - this['re'] * x) / t); + } + }, + + /** + * Calculate the power of two complex numbers + * + * @returns {Complex} + */ + 'pow': function (a, b) { + + const z = parse(a, b); + + const tIsZero = this['re'] === 0 && this['im'] === 0; + const zIsZero = z['re'] === 0 && z['im'] === 0; + + if (zIsZero) { + return Complex['ONE']; + } + + // If the exponent is real + if (z['im'] === 0) { + + if (this['im'] === 0 && this['re'] > 0) { + + return new Complex(Math.pow(this['re'], z['re']), 0); + + } else if (this['re'] === 0) { // If base is fully imaginary + + switch ((z['re'] % 4 + 4) % 4) { + case 0: + return new Complex(Math.pow(this['im'], z['re']), 0); + case 1: + return new Complex(0, Math.pow(this['im'], z['re'])); + case 2: + return new Complex(-Math.pow(this['im'], z['re']), 0); + case 3: + return new Complex(0, -Math.pow(this['im'], z['re'])); + } + } + } + + /* I couldn't find a good formula, so here is a derivation and optimization + * + * z_1^z_2 = (a + bi)^(c + di) + * = exp((c + di) * log(a + bi) + * = pow(a^2 + b^2, (c + di) / 2) * exp(i(c + di)atan2(b, a)) + * =>... + * Re = (pow(a^2 + b^2, c / 2) * exp(-d * atan2(b, a))) * cos(d * log(a^2 + b^2) / 2 + c * atan2(b, a)) + * Im = (pow(a^2 + b^2, c / 2) * exp(-d * atan2(b, a))) * sin(d * log(a^2 + b^2) / 2 + c * atan2(b, a)) + * + * =>... + * Re = exp(c * log(sqrt(a^2 + b^2)) - d * atan2(b, a)) * cos(d * log(sqrt(a^2 + b^2)) + c * atan2(b, a)) + * Im = exp(c * log(sqrt(a^2 + b^2)) - d * atan2(b, a)) * sin(d * log(sqrt(a^2 + b^2)) + c * atan2(b, a)) + * + * => + * Re = exp(c * logsq2 - d * arg(z_1)) * cos(d * logsq2 + c * arg(z_1)) + * Im = exp(c * logsq2 - d * arg(z_1)) * sin(d * logsq2 + c * arg(z_1)) + * + */ + + if (tIsZero && z['re'] > 0) { // Same behavior as Wolframalpha, Zero if real part is zero + return Complex['ZERO']; + } + + const arg = Math.atan2(this['im'], this['re']); + const loh = logHypot(this['re'], this['im']); + + let re = Math.exp(z['re'] * loh - z['im'] * arg); + let im = z['im'] * loh + z['re'] * arg; + return new Complex( + re * Math.cos(im), + re * Math.sin(im)); + }, + + /** + * Calculate the complex square root + * + * @returns {Complex} + */ + 'sqrt': function () { + + const a = this['re']; + const b = this['im']; + + if (b === 0) { + // Real number case + if (a >= 0) { + return new Complex(Math.sqrt(a), 0); + } else { + return new Complex(0, Math.sqrt(-a)); + } + } + + const r = hypot(a, b); + + let re = Math.sqrt(0.5 * (r + Math.abs(a))); // sqrt(2x) / 2 = sqrt(x / 2) + let im = Math.abs(b) / (2 * re); + + if (a >= 0) { + return new Complex(re, b < 0 ? -im : im); + } else { + return new Complex(im, b < 0 ? -re : re); + } + }, + + /** + * Calculate the complex exponent + * + * @returns {Complex} + */ + 'exp': function () { + + const er = Math.exp(this['re']); + + if (this['im'] === 0) { + return new Complex(er, 0); + } + return new Complex( + er * Math.cos(this['im']), + er * Math.sin(this['im'])); + }, + + /** + * Calculate the complex exponent and subtracts one. + * + * This may be more accurate than `Complex(x).exp().sub(1)` if + * `x` is small. + * + * @returns {Complex} + */ + 'expm1': function () { + + /** + * exp(a + i*b) - 1 + = exp(a) * (cos(b) + j*sin(b)) - 1 + = expm1(a)*cos(b) + cosm1(b) + j*exp(a)*sin(b) + */ + + const a = this['re']; + const b = this['im']; + + return new Complex( + Math.expm1(a) * Math.cos(b) + cosm1(b), + Math.exp(a) * Math.sin(b)); + }, + + /** + * Calculate the natural log + * + * @returns {Complex} + */ + 'log': function () { + + const a = this['re']; + const b = this['im']; + + if (b === 0 && a > 0) { + return new Complex(Math.log(a), 0); + } + + return new Complex( + logHypot(a, b), + Math.atan2(b, a)); + }, + + /** + * Calculate the magnitude of the complex number + * + * @returns {number} + */ + 'abs': function () { + + return hypot(this['re'], this['im']); + }, + + /** + * Calculate the angle of the complex number + * + * @returns {number} + */ + 'arg': function () { + + return Math.atan2(this['im'], this['re']); + }, + + /** + * Calculate the sine of the complex number + * + * @returns {Complex} + */ + 'sin': function () { + + // sin(z) = ( e^iz - e^-iz ) / 2i + // = sin(a)cosh(b) + i cos(a)sinh(b) + + const a = this['re']; + const b = this['im']; + + return new Complex( + Math.sin(a) * cosh(b), + Math.cos(a) * sinh(b)); + }, + + /** + * Calculate the cosine + * + * @returns {Complex} + */ + 'cos': function () { + + // cos(z) = ( e^iz + e^-iz ) / 2 + // = cos(a)cosh(b) - i sin(a)sinh(b) + + const a = this['re']; + const b = this['im']; + + return new Complex( + Math.cos(a) * cosh(b), + -Math.sin(a) * sinh(b)); + }, + + /** + * Calculate the tangent + * + * @returns {Complex} + */ + 'tan': function () { + + // tan(z) = sin(z) / cos(z) + // = ( e^iz - e^-iz ) / ( i( e^iz + e^-iz ) ) + // = ( e^2iz - 1 ) / i( e^2iz + 1 ) + // = ( sin(2a) + i sinh(2b) ) / ( cos(2a) + cosh(2b) ) + + const a = 2 * this['re']; + const b = 2 * this['im']; + const d = Math.cos(a) + cosh(b); + + return new Complex( + Math.sin(a) / d, + sinh(b) / d); + }, + + /** + * Calculate the cotangent + * + * @returns {Complex} + */ + 'cot': function () { + + // cot(c) = i(e^(ci) + e^(-ci)) / (e^(ci) - e^(-ci)) + + const a = 2 * this['re']; + const b = 2 * this['im']; + const d = Math.cos(a) - cosh(b); + + return new Complex( + -Math.sin(a) / d, + sinh(b) / d); + }, + + /** + * Calculate the secant + * + * @returns {Complex} + */ + 'sec': function () { + + // sec(c) = 2 / (e^(ci) + e^(-ci)) + + const a = this['re']; + const b = this['im']; + const d = 0.5 * cosh(2 * b) + 0.5 * Math.cos(2 * a); + + return new Complex( + Math.cos(a) * cosh(b) / d, + Math.sin(a) * sinh(b) / d); + }, + + /** + * Calculate the cosecans + * + * @returns {Complex} + */ + 'csc': function () { + + // csc(c) = 2i / (e^(ci) - e^(-ci)) + + const a = this['re']; + const b = this['im']; + const d = 0.5 * cosh(2 * b) - 0.5 * Math.cos(2 * a); + + return new Complex( + Math.sin(a) * cosh(b) / d, + -Math.cos(a) * sinh(b) / d); + }, + + /** + * Calculate the complex arcus sinus + * + * @returns {Complex} + */ + 'asin': function () { + + // asin(c) = -i * log(ci + sqrt(1 - c^2)) + + const a = this['re']; + const b = this['im']; + + const t1 = new Complex( + b * b - a * a + 1, + -2 * a * b)['sqrt'](); + + const t2 = new Complex( + t1['re'] - b, + t1['im'] + a)['log'](); + + return new Complex(t2['im'], -t2['re']); + }, + + /** + * Calculate the complex arcus cosinus + * + * @returns {Complex} + */ + 'acos': function () { + + // acos(c) = i * log(c - i * sqrt(1 - c^2)) + + const a = this['re']; + const b = this['im']; + + const t1 = new Complex( + b * b - a * a + 1, + -2 * a * b)['sqrt'](); + + const t2 = new Complex( + t1['re'] - b, + t1['im'] + a)['log'](); + + return new Complex(Math.PI / 2 - t2['im'], t2['re']); + }, + + /** + * Calculate the complex arcus tangent + * + * @returns {Complex} + */ + 'atan': function () { + + // atan(c) = i / 2 log((i + x) / (i - x)) + + const a = this['re']; + const b = this['im']; + + if (a === 0) { + + if (b === 1) { + return new Complex(0, Infinity); + } + + if (b === -1) { + return new Complex(0, -Infinity); + } + } + + const d = a * a + (1.0 - b) * (1.0 - b); + + const t1 = new Complex( + (1 - b * b - a * a) / d, + -2 * a / d).log(); + + return new Complex(-0.5 * t1['im'], 0.5 * t1['re']); + }, + + /** + * Calculate the complex arcus cotangent + * + * @returns {Complex} + */ + 'acot': function () { + + // acot(c) = i / 2 log((c - i) / (c + i)) + + const a = this['re']; + const b = this['im']; + + if (b === 0) { + return new Complex(Math.atan2(1, a), 0); + } + + const d = a * a + b * b; + return (d !== 0) + ? new Complex( + a / d, + -b / d).atan() + : new Complex( + (a !== 0) ? a / 0 : 0, + (b !== 0) ? -b / 0 : 0).atan(); + }, + + /** + * Calculate the complex arcus secant + * + * @returns {Complex} + */ + 'asec': function () { + + // asec(c) = -i * log(1 / c + sqrt(1 - i / c^2)) + + const a = this['re']; + const b = this['im']; + + if (a === 0 && b === 0) { + return new Complex(0, Infinity); + } + + const d = a * a + b * b; + return (d !== 0) + ? new Complex( + a / d, + -b / d).acos() + : new Complex( + (a !== 0) ? a / 0 : 0, + (b !== 0) ? -b / 0 : 0).acos(); + }, + + /** + * Calculate the complex arcus cosecans + * + * @returns {Complex} + */ + 'acsc': function () { + + // acsc(c) = -i * log(i / c + sqrt(1 - 1 / c^2)) + + const a = this['re']; + const b = this['im']; + + if (a === 0 && b === 0) { + return new Complex(Math.PI / 2, Infinity); + } + + const d = a * a + b * b; + return (d !== 0) + ? new Complex( + a / d, + -b / d).asin() + : new Complex( + (a !== 0) ? a / 0 : 0, + (b !== 0) ? -b / 0 : 0).asin(); + }, + + /** + * Calculate the complex sinh + * + * @returns {Complex} + */ + 'sinh': function () { + + // sinh(c) = (e^c - e^-c) / 2 + + const a = this['re']; + const b = this['im']; + + return new Complex( + sinh(a) * Math.cos(b), + cosh(a) * Math.sin(b)); + }, + + /** + * Calculate the complex cosh + * + * @returns {Complex} + */ + 'cosh': function () { + + // cosh(c) = (e^c + e^-c) / 2 + + const a = this['re']; + const b = this['im']; + + return new Complex( + cosh(a) * Math.cos(b), + sinh(a) * Math.sin(b)); + }, + + /** + * Calculate the complex tanh + * + * @returns {Complex} + */ + 'tanh': function () { + + // tanh(c) = (e^c - e^-c) / (e^c + e^-c) + + const a = 2 * this['re']; + const b = 2 * this['im']; + const d = cosh(a) + Math.cos(b); + + return new Complex( + sinh(a) / d, + Math.sin(b) / d); + }, + + /** + * Calculate the complex coth + * + * @returns {Complex} + */ + 'coth': function () { + + // coth(c) = (e^c + e^-c) / (e^c - e^-c) + + const a = 2 * this['re']; + const b = 2 * this['im']; + const d = cosh(a) - Math.cos(b); + + return new Complex( + sinh(a) / d, + -Math.sin(b) / d); + }, + + /** + * Calculate the complex coth + * + * @returns {Complex} + */ + 'csch': function () { + + // csch(c) = 2 / (e^c - e^-c) + + const a = this['re']; + const b = this['im']; + const d = Math.cos(2 * b) - cosh(2 * a); + + return new Complex( + -2 * sinh(a) * Math.cos(b) / d, + 2 * cosh(a) * Math.sin(b) / d); + }, + + /** + * Calculate the complex sech + * + * @returns {Complex} + */ + 'sech': function () { + + // sech(c) = 2 / (e^c + e^-c) + + const a = this['re']; + const b = this['im']; + const d = Math.cos(2 * b) + cosh(2 * a); + + return new Complex( + 2 * cosh(a) * Math.cos(b) / d, + -2 * sinh(a) * Math.sin(b) / d); + }, + + /** + * Calculate the complex asinh + * + * @returns {Complex} + */ + 'asinh': function () { + + // asinh(c) = log(c + sqrt(c^2 + 1)) + + let tmp = this['im']; + this['im'] = -this['re']; + this['re'] = tmp; + const res = this['asin'](); + + this['re'] = -this['im']; + this['im'] = tmp; + tmp = res['re']; + + res['re'] = -res['im']; + res['im'] = tmp; + return res; + }, + + /** + * Calculate the complex acosh + * + * @returns {Complex} + */ + 'acosh': function () { + + // acosh(c) = log(c + sqrt(c^2 - 1)) + + const res = this['acos'](); + if (res['im'] <= 0) { + const tmp = res['re']; + res['re'] = -res['im']; + res['im'] = tmp; + } else { + const tmp = res['im']; + res['im'] = -res['re']; + res['re'] = tmp; + } + return res; + }, + + /** + * Calculate the complex atanh + * + * @returns {Complex} + */ + 'atanh': function () { + + // atanh(c) = log((1+c) / (1-c)) / 2 + + const a = this['re']; + const b = this['im']; + + const noIM = a > 1 && b === 0; + const oneMinus = 1 - a; + const onePlus = 1 + a; + const d = oneMinus * oneMinus + b * b; + + const x = (d !== 0) + ? new Complex( + (onePlus * oneMinus - b * b) / d, + (b * oneMinus + onePlus * b) / d) + : new Complex( + (a !== -1) ? (a / 0) : 0, + (b !== 0) ? (b / 0) : 0); + + const temp = x['re']; + x['re'] = logHypot(x['re'], x['im']) / 2; + x['im'] = Math.atan2(x['im'], temp) / 2; + if (noIM) { + x['im'] = -x['im']; + } + return x; + }, + + /** + * Calculate the complex acoth + * + * @returns {Complex} + */ + 'acoth': function () { + + // acoth(c) = log((c+1) / (c-1)) / 2 + + const a = this['re']; + const b = this['im']; + + if (a === 0 && b === 0) { + return new Complex(0, Math.PI / 2); + } + + const d = a * a + b * b; + return (d !== 0) + ? new Complex( + a / d, + -b / d).atanh() + : new Complex( + (a !== 0) ? a / 0 : 0, + (b !== 0) ? -b / 0 : 0).atanh(); + }, + + /** + * Calculate the complex acsch + * + * @returns {Complex} + */ + 'acsch': function () { + + // acsch(c) = log((1+sqrt(1+c^2))/c) + + const a = this['re']; + const b = this['im']; + + if (b === 0) { + + return new Complex( + (a !== 0) + ? Math.log(a + Math.sqrt(a * a + 1)) + : Infinity, 0); + } + + const d = a * a + b * b; + return (d !== 0) + ? new Complex( + a / d, + -b / d).asinh() + : new Complex( + (a !== 0) ? a / 0 : 0, + (b !== 0) ? -b / 0 : 0).asinh(); + }, + + /** + * Calculate the complex asech + * + * @returns {Complex} + */ + 'asech': function () { + + // asech(c) = log((1+sqrt(1-c^2))/c) + + const a = this['re']; + const b = this['im']; + + if (this['isZero']()) { + return Complex['INFINITY']; + } + + const d = a * a + b * b; + return (d !== 0) + ? new Complex( + a / d, + -b / d).acosh() + : new Complex( + (a !== 0) ? a / 0 : 0, + (b !== 0) ? -b / 0 : 0).acosh(); + }, + + /** + * Calculate the complex inverse 1/z + * + * @returns {Complex} + */ + 'inverse': function () { + + // 1 / 0 = Infinity and 1 / Infinity = 0 + if (this['isZero']()) { + return Complex['INFINITY']; + } + + if (this['isInfinite']()) { + return Complex['ZERO']; + } + + const a = this['re']; + const b = this['im']; + + const d = a * a + b * b; + + return new Complex(a / d, -b / d); + }, + + /** + * Returns the complex conjugate + * + * @returns {Complex} + */ + 'conjugate': function () { + + return new Complex(this['re'], -this['im']); + }, + + /** + * Gets the negated complex number + * + * @returns {Complex} + */ + 'neg': function () { + + return new Complex(-this['re'], -this['im']); + }, + + /** + * Ceils the actual complex number + * + * @returns {Complex} + */ + 'ceil': function (places) { + + places = Math.pow(10, places || 0); + + return new Complex( + Math.ceil(this['re'] * places) / places, + Math.ceil(this['im'] * places) / places); + }, + + /** + * Floors the actual complex number + * + * @returns {Complex} + */ + 'floor': function (places) { + + places = Math.pow(10, places || 0); + + return new Complex( + Math.floor(this['re'] * places) / places, + Math.floor(this['im'] * places) / places); + }, + + /** + * Ceils the actual complex number + * + * @returns {Complex} + */ + 'round': function (places) { + + places = Math.pow(10, places || 0); + + return new Complex( + Math.round(this['re'] * places) / places, + Math.round(this['im'] * places) / places); + }, + + /** + * Compares two complex numbers + * + * **Note:** new Complex(Infinity).equals(Infinity) === false + * + * @returns {boolean} + */ + 'equals': function (a, b) { + + const z = parse(a, b); + + return Math.abs(z['re'] - this['re']) <= Complex['EPSILON'] && + Math.abs(z['im'] - this['im']) <= Complex['EPSILON']; + }, + + /** + * Clones the actual object + * + * @returns {Complex} + */ + 'clone': function () { + + return new Complex(this['re'], this['im']); + }, + + /** + * Gets a string of the actual complex number + * + * @returns {string} + */ + 'toString': function () { + + let a = this['re']; + let b = this['im']; + let ret = ""; + + if (this['isNaN']()) { + return 'NaN'; + } + + if (this['isInfinite']()) { + return 'Infinity'; + } + + if (Math.abs(a) < Complex['EPSILON']) { + a = 0; + } + + if (Math.abs(b) < Complex['EPSILON']) { + b = 0; + } + + // If is real number + if (b === 0) { + return ret + a; + } + + if (a !== 0) { + ret += a; + ret += " "; + if (b < 0) { + b = -b; + ret += "-"; + } else { + ret += "+"; + } + ret += " "; + } else if (b < 0) { + b = -b; + ret += "-"; + } + + if (1 !== b) { // b is the absolute imaginary part + ret += b; + } + return ret + "i"; + }, + + /** + * Returns the actual number as a vector + * + * @returns {Array} + */ + 'toVector': function () { + + return [this['re'], this['im']]; + }, + + /** + * Returns the actual real value of the current object + * + * @returns {number|null} + */ + 'valueOf': function () { + + if (this['im'] === 0) { + return this['re']; + } + return null; + }, + + /** + * Determines whether a complex number is not on the Riemann sphere. + * + * @returns {boolean} + */ + 'isNaN': function () { + return isNaN(this['re']) || isNaN(this['im']); + }, + + /** + * Determines whether or not a complex number is at the zero pole of the + * Riemann sphere. + * + * @returns {boolean} + */ + 'isZero': function () { + return this['im'] === 0 && this['re'] === 0; + }, + + /** + * Determines whether a complex number is not at the infinity pole of the + * Riemann sphere. + * + * @returns {boolean} + */ + 'isFinite': function () { + return isFinite(this['re']) && isFinite(this['im']); + }, + + /** + * Determines whether or not a complex number is at the infinity pole of the + * Riemann sphere. + * + * @returns {boolean} + */ + 'isInfinite': function () { + return !this['isFinite'](); + } +}; + +Complex['ZERO'] = new Complex(0, 0); +Complex['ONE'] = new Complex(1, 0); +Complex['I'] = new Complex(0, 1); +Complex['PI'] = new Complex(Math.PI, 0); +Complex['E'] = new Complex(Math.E, 0); +Complex['INFINITY'] = new Complex(Infinity, Infinity); +Complex['NAN'] = new Complex(NaN, NaN); +Complex['EPSILON'] = 1e-15; + +Object.defineProperty(Complex, "__esModule", { 'value': true }); +Complex['default'] = Complex; +Complex['Complex'] = Complex; +module['exports'] = Complex; diff --git a/node_modules/complex.js/dist/complex.min.js b/node_modules/complex.js/dist/complex.min.js new file mode 100644 index 0000000..722aaf7 --- /dev/null +++ b/node_modules/complex.js/dist/complex.min.js @@ -0,0 +1,26 @@ +/* +Complex.js v2.4.2 11/5/2024 +https://raw.org/article/complex-numbers-in-javascript/ + +Copyright (c) 2024, Robert Eisele (https://raw.org/) +Licensed under the MIT license. +*/ +'use strict';(function(r){function l(a,b){if(void 0===a||null===a)f.re=f.im=0;else if(void 0!==b)f.re=a,f.im=b;else switch(typeof a){case "object":if("im"in a&&"re"in a)f.re=a.re,f.im=a.im;else if("abs"in a&&"arg"in a){if(!isFinite(a.abs)&&isFinite(a.arg))return c.INFINITY;f.re=a.abs*Math.cos(a.arg);f.im=a.abs*Math.sin(a.arg)}else if("r"in a&&"phi"in a){if(!isFinite(a.r)&&isFinite(a.phi))return c.INFINITY;f.re=a.r*Math.cos(a.phi);f.im=a.r*Math.sin(a.phi)}else 2===a.length?(f.re=a[0],f.im=a[1]):m(); +break;case "string":f.im=f.re=0;a=a.replace(/_/g,"").match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g);b=1;let d=0;null===a&&m();for(let e=0;ea)return Math.sqrt(a*a+b*b);b/=a;return a*Math.sqrt(1+b*b)}function p(a,b){const d=Math.abs(a),e=Math.abs(b);if(0===a)return Math.log(e);if(0===b)return Math.log(d);if(3E3>d&&3E3>e)return.5*Math.log(a*a+b*b);a*=.5;b*=.5;return.5*Math.log(a*a+b*b)+Math.LN2}function c(a,b){if(!(this instanceof c))return new c(a,b);a=l(a, +b);this.re=a.re;this.im=a.im}const h=Math.cosh||function(a){return 1E-9>Math.abs(a)?1-a:.5*(Math.exp(a)+Math.exp(-a))},k=Math.sinh||function(a){return 1E-9>Math.abs(a)?a:.5*(Math.exp(a)-Math.exp(-a))},f={re:0,im:0};c.prototype={re:0,im:0,sign:function(){const a=n(this.re,this.im);return new c(this.re/a,this.im/a)},add:function(a,b){a=l(a,b);b=this.isInfinite();const d=!(isFinite(a.re)&&isFinite(a.im));return b||d?b&&d?c.NAN:c.INFINITY:new c(this.re+a.re,this.im+a.im)},sub:function(a,b){a=l(a,b);b= +this.isInfinite();const d=!(isFinite(a.re)&&isFinite(a.im));return b||d?b&&d?c.NAN:c.INFINITY:new c(this.re-a.re,this.im-a.im)},mul:function(a,b){a=l(a,b);b=this.isInfinite();const d=!(isFinite(a.re)&&isFinite(a.im)),e=0===this.re&&0===this.im,g=0===a.re&&0===a.im;return b&&g||d&&e?c.NAN:b||d?c.INFINITY:0===a.im&&0===this.im?new c(this.re*a.re,0):new c(this.re*a.re-this.im*a.im,this.re*a.im+this.im*a.re)},div:function(a,b){a=l(a,b);b=this.isInfinite();const d=!(isFinite(a.re)&&isFinite(a.im)),e=0=== +this.re&&0===this.im,g=0===a.re&&0===a.im;if(e&&g||b&&d)return c.NAN;if(g||b)return c.INFINITY;if(e||d)return c.ZERO;if(0===a.im)return new c(this.re/a.re,this.im/a.re);if(Math.abs(a.re)b?-e:e):new c(e,0>b?-d:d)},exp:function(){const a=Math.exp(this.re);return 0===this.im?new c(a,0):new c(a*Math.cos(this.im),a*Math.sin(this.im))},expm1:function(){const a=this.re,b=this.im;var d=Math.expm1(a)*Math.cos(b);var e=Math.PI/4;-e>b||b>e?e=Math.cos(b)-1:(e=b*b,e*=e*(e*(e*(e*(e*(e*(e/20922789888E3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-.5);return new c(d+e,Math.exp(a)*Math.sin(b))}, +log:function(){const a=this.re,b=this.im;return 0===b&&0=a.im){var b=a.re;a.re=-a.im;a.im=b}else b=a.im,a.im=-a.re,a.re=b;return a},atanh:function(){var a=this.re,b=this.im;const d=1b?(b=-b,d+="-"):d+="+",d+=" "):0>b&&(b=-b,d+="-");1!== +b&&(d+=b);return d+"i"},toVector:function(){return[this.re,this.im]},valueOf:function(){return 0===this.im?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return 0===this.im&&0===this.re},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!this.isFinite()}};c.ZERO=new c(0,0);c.ONE=new c(1,0);c.I=new c(0,1);c.PI=new c(Math.PI,0);c.E=new c(Math.E,0);c.INFINITY=new c(Infinity,Infinity);c.NAN=new c(NaN,NaN);c.EPSILON=1E-15; +"function"===typeof define&&define.amd?define([],function(){return c}):"object"===typeof exports?(Object.defineProperty(c,"__esModule",{value:!0}),c["default"]=c,c.Complex=c,module.exports=c):r.Complex=c})(this); diff --git a/node_modules/complex.js/dist/complex.mjs b/node_modules/complex.js/dist/complex.mjs new file mode 100644 index 0000000..2eead9b --- /dev/null +++ b/node_modules/complex.js/dist/complex.mjs @@ -0,0 +1,1411 @@ +'use strict'; + +/** + * + * This class allows the manipulation of complex numbers. + * You can pass a complex number in different formats. Either as object, double, string or two integer parameters. + * + * Object form + * { re: , im: } + * { arg: , abs: } + * { phi: , r: } + * + * Array / Vector form + * [ real, imaginary ] + * + * Double form + * 99.3 - Single double value + * + * String form + * '23.1337' - Simple real number + * '15+3i' - a simple complex number + * '3-i' - a simple complex number + * + * Example: + * + * const c = new Complex('99.3+8i'); + * c.mul({r: 3, i: 9}).div(4.9).sub(3, 2); + * + */ + + +const cosh = Math.cosh || function (x) { + return Math.abs(x) < 1e-9 ? 1 - x : (Math.exp(x) + Math.exp(-x)) * 0.5; +}; + +const sinh = Math.sinh || function (x) { + return Math.abs(x) < 1e-9 ? x : (Math.exp(x) - Math.exp(-x)) * 0.5; +}; + +/** + * Calculates cos(x) - 1 using Taylor series if x is small (-¼π ≤ x ≤ ¼π). + * + * @param {number} x + * @returns {number} cos(x) - 1 + */ +const cosm1 = function (x) { + + const b = Math.PI / 4; + if (-b > x || x > b) { + return Math.cos(x) - 1.0; + } + + /* Calculate horner form of polynomial of taylor series in Q + let fac = 1, alt = 1, pol = {}; + for (let i = 0; i <= 16; i++) { + fac*= i || 1; + if (i % 2 == 0) { + pol[i] = new Fraction(1, alt * fac); + alt = -alt; + } + } + console.log(new Polynomial(pol).toHorner()); // (((((((1/20922789888000x^2-1/87178291200)x^2+1/479001600)x^2-1/3628800)x^2+1/40320)x^2-1/720)x^2+1/24)x^2-1/2)x^2+1 + */ + + const xx = x * x; + return xx * ( + xx * ( + xx * ( + xx * ( + xx * ( + xx * ( + xx * ( + xx / 20922789888000 + - 1 / 87178291200) + + 1 / 479001600) + - 1 / 3628800) + + 1 / 40320) + - 1 / 720) + + 1 / 24) + - 1 / 2); +}; + +const hypot = function (x, y) { + + x = Math.abs(x); + y = Math.abs(y); + + // Ensure `x` is the larger value + if (x < y) [x, y] = [y, x]; + + // If both are below the threshold, use straightforward Pythagoras + if (x < 1e8) return Math.sqrt(x * x + y * y); + + // For larger values, scale to avoid overflow + y /= x; + return x * Math.sqrt(1 + y * y); +}; + +const parser_exit = function () { + throw SyntaxError('Invalid Param'); +}; + +/** + * Calculates log(sqrt(a^2+b^2)) in a way to avoid overflows + * + * @param {number} a + * @param {number} b + * @returns {number} + */ +function logHypot(a, b) { + + const _a = Math.abs(a); + const _b = Math.abs(b); + + if (a === 0) { + return Math.log(_b); + } + + if (b === 0) { + return Math.log(_a); + } + + if (_a < 3000 && _b < 3000) { + return Math.log(a * a + b * b) * 0.5; + } + + /* I got 4 ideas to compute this property without overflow: + * + * Testing 1000000 times with random samples for a,b ∈ [1, 1000000000] against a big decimal library to get an error estimate + * + * 1. Only eliminate the square root: (OVERALL ERROR: 3.9122483030951116e-11) + + Math.log(a * a + b * b) / 2 + + * + * + * 2. Try to use the non-overflowing pythagoras: (OVERALL ERROR: 8.889760039210159e-10) + + const fn = function(a, b) { + a = Math.abs(a); + b = Math.abs(b); + let t = Math.min(a, b); + a = Math.max(a, b); + t = t / a; + + return Math.log(a) + Math.log(1 + t * t) / 2; + }; + + * 3. Abuse the identity cos(atan(y/x) = x / sqrt(x^2+y^2): (OVERALL ERROR: 3.4780178737037204e-10) + + Math.log(a / Math.cos(Math.atan2(b, a))) + + * 4. Use 3. and apply log rules: (OVERALL ERROR: 1.2014087502620896e-9) + + Math.log(a) - Math.log(Math.cos(Math.atan2(b, a))) + + */ + + a = a * 0.5; + b = b * 0.5; + + return 0.5 * Math.log(a * a + b * b) + Math.LN2; +} + +const P = { 're': 0, 'im': 0 }; +const parse = function (a, b) { + + const z = P; + + if (a === undefined || a === null) { + z['re'] = + z['im'] = 0; + } else if (b !== undefined) { + z['re'] = a; + z['im'] = b; + } else + switch (typeof a) { + + case 'object': + + if ('im' in a && 're' in a) { + z['re'] = a['re']; + z['im'] = a['im']; + } else if ('abs' in a && 'arg' in a) { + if (!isFinite(a['abs']) && isFinite(a['arg'])) { + return Complex['INFINITY']; + } + z['re'] = a['abs'] * Math.cos(a['arg']); + z['im'] = a['abs'] * Math.sin(a['arg']); + } else if ('r' in a && 'phi' in a) { + if (!isFinite(a['r']) && isFinite(a['phi'])) { + return Complex['INFINITY']; + } + z['re'] = a['r'] * Math.cos(a['phi']); + z['im'] = a['r'] * Math.sin(a['phi']); + } else if (a.length === 2) { // Quick array check + z['re'] = a[0]; + z['im'] = a[1]; + } else { + parser_exit(); + } + break; + + case 'string': + + z['im'] = /* void */ + z['re'] = 0; + + const tokens = a.replace(/_/g, '') + .match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g); + let plus = 1; + let minus = 0; + + if (tokens === null) { + parser_exit(); + } + + for (let i = 0; i < tokens.length; i++) { + + const c = tokens[i]; + + if (c === ' ' || c === '\t' || c === '\n') { + /* void */ + } else if (c === '+') { + plus++; + } else if (c === '-') { + minus++; + } else if (c === 'i' || c === 'I') { + + if (plus + minus === 0) { + parser_exit(); + } + + if (tokens[i + 1] !== ' ' && !isNaN(tokens[i + 1])) { + z['im'] += parseFloat((minus % 2 ? '-' : '') + tokens[i + 1]); + i++; + } else { + z['im'] += parseFloat((minus % 2 ? '-' : '') + '1'); + } + plus = minus = 0; + + } else { + + if (plus + minus === 0 || isNaN(c)) { + parser_exit(); + } + + if (tokens[i + 1] === 'i' || tokens[i + 1] === 'I') { + z['im'] += parseFloat((minus % 2 ? '-' : '') + c); + i++; + } else { + z['re'] += parseFloat((minus % 2 ? '-' : '') + c); + } + plus = minus = 0; + } + } + + // Still something on the stack + if (plus + minus > 0) { + parser_exit(); + } + break; + + case 'number': + z['im'] = 0; + z['re'] = a; + break; + + default: + parser_exit(); + } + + if (isNaN(z['re']) || isNaN(z['im'])) { + // If a calculation is NaN, we treat it as NaN and don't throw + //parser_exit(); + } + + return z; +}; + +/** + * @constructor + * @returns {Complex} + */ +function Complex(a, b) { + + if (!(this instanceof Complex)) { + return new Complex(a, b); + } + + const z = parse(a, b); + + this['re'] = z['re']; + this['im'] = z['im']; +} + +Complex.prototype = { + + 're': 0, + 'im': 0, + + /** + * Calculates the sign of a complex number, which is a normalized complex + * + * @returns {Complex} + */ + 'sign': function () { + + const abs = hypot(this['re'], this['im']); + + return new Complex( + this['re'] / abs, + this['im'] / abs); + }, + + /** + * Adds two complex numbers + * + * @returns {Complex} + */ + 'add': function (a, b) { + + const z = parse(a, b); + + const tInfin = this['isInfinite'](); + const zInfin = !(isFinite(z['re']) && isFinite(z['im'])); + + if (tInfin || zInfin) { + + if (tInfin && zInfin) { + // Infinity + Infinity = NaN + return Complex['NAN']; + } + // Infinity + z = Infinity { where z != Infinity } + return Complex['INFINITY']; + } + + return new Complex( + this['re'] + z['re'], + this['im'] + z['im']); + }, + + /** + * Subtracts two complex numbers + * + * @returns {Complex} + */ + 'sub': function (a, b) { + + const z = parse(a, b); + + const tInfin = this['isInfinite'](); + const zInfin = !(isFinite(z['re']) && isFinite(z['im'])); + + if (tInfin || zInfin) { + + if (tInfin && zInfin) { + // Infinity - Infinity = NaN + return Complex['NAN']; + } + // Infinity - z = Infinity { where z != Infinity } + return Complex['INFINITY']; + } + + return new Complex( + this['re'] - z['re'], + this['im'] - z['im']); + }, + + /** + * Multiplies two complex numbers + * + * @returns {Complex} + */ + 'mul': function (a, b) { + + const z = parse(a, b); + + const tInfin = this['isInfinite'](); + const zInfin = !(isFinite(z['re']) && isFinite(z['im'])); + const tIsZero = this['re'] === 0 && this['im'] === 0; + const zIsZero = z['re'] === 0 && z['im'] === 0; + + // Infinity * 0 = NaN + if (tInfin && zIsZero || zInfin && tIsZero) { + return Complex['NAN']; + } + + // Infinity * z = Infinity { where z != 0 } + if (tInfin || zInfin) { + return Complex['INFINITY']; + } + + // Shortcut for real values + if (z['im'] === 0 && this['im'] === 0) { + return new Complex(this['re'] * z['re'], 0); + } + + return new Complex( + this['re'] * z['re'] - this['im'] * z['im'], + this['re'] * z['im'] + this['im'] * z['re']); + }, + + /** + * Divides two complex numbers + * + * @returns {Complex} + */ + 'div': function (a, b) { + + const z = parse(a, b); + + const tInfin = this['isInfinite'](); + const zInfin = !(isFinite(z['re']) && isFinite(z['im'])); + const tIsZero = this['re'] === 0 && this['im'] === 0; + const zIsZero = z['re'] === 0 && z['im'] === 0; + + // 0 / 0 = NaN and Infinity / Infinity = NaN + if (tIsZero && zIsZero || tInfin && zInfin) { + return Complex['NAN']; + } + + // Infinity / 0 = Infinity + if (zIsZero || tInfin) { + return Complex['INFINITY']; + } + + // 0 / Infinity = 0 + if (tIsZero || zInfin) { + return Complex['ZERO']; + } + + if (0 === z['im']) { + // Divisor is real + return new Complex(this['re'] / z['re'], this['im'] / z['re']); + } + + if (Math.abs(z['re']) < Math.abs(z['im'])) { + + const x = z['re'] / z['im']; + const t = z['re'] * x + z['im']; + + return new Complex( + (this['re'] * x + this['im']) / t, + (this['im'] * x - this['re']) / t); + + } else { + + const x = z['im'] / z['re']; + const t = z['im'] * x + z['re']; + + return new Complex( + (this['re'] + this['im'] * x) / t, + (this['im'] - this['re'] * x) / t); + } + }, + + /** + * Calculate the power of two complex numbers + * + * @returns {Complex} + */ + 'pow': function (a, b) { + + const z = parse(a, b); + + const tIsZero = this['re'] === 0 && this['im'] === 0; + const zIsZero = z['re'] === 0 && z['im'] === 0; + + if (zIsZero) { + return Complex['ONE']; + } + + // If the exponent is real + if (z['im'] === 0) { + + if (this['im'] === 0 && this['re'] > 0) { + + return new Complex(Math.pow(this['re'], z['re']), 0); + + } else if (this['re'] === 0) { // If base is fully imaginary + + switch ((z['re'] % 4 + 4) % 4) { + case 0: + return new Complex(Math.pow(this['im'], z['re']), 0); + case 1: + return new Complex(0, Math.pow(this['im'], z['re'])); + case 2: + return new Complex(-Math.pow(this['im'], z['re']), 0); + case 3: + return new Complex(0, -Math.pow(this['im'], z['re'])); + } + } + } + + /* I couldn't find a good formula, so here is a derivation and optimization + * + * z_1^z_2 = (a + bi)^(c + di) + * = exp((c + di) * log(a + bi) + * = pow(a^2 + b^2, (c + di) / 2) * exp(i(c + di)atan2(b, a)) + * =>... + * Re = (pow(a^2 + b^2, c / 2) * exp(-d * atan2(b, a))) * cos(d * log(a^2 + b^2) / 2 + c * atan2(b, a)) + * Im = (pow(a^2 + b^2, c / 2) * exp(-d * atan2(b, a))) * sin(d * log(a^2 + b^2) / 2 + c * atan2(b, a)) + * + * =>... + * Re = exp(c * log(sqrt(a^2 + b^2)) - d * atan2(b, a)) * cos(d * log(sqrt(a^2 + b^2)) + c * atan2(b, a)) + * Im = exp(c * log(sqrt(a^2 + b^2)) - d * atan2(b, a)) * sin(d * log(sqrt(a^2 + b^2)) + c * atan2(b, a)) + * + * => + * Re = exp(c * logsq2 - d * arg(z_1)) * cos(d * logsq2 + c * arg(z_1)) + * Im = exp(c * logsq2 - d * arg(z_1)) * sin(d * logsq2 + c * arg(z_1)) + * + */ + + if (tIsZero && z['re'] > 0) { // Same behavior as Wolframalpha, Zero if real part is zero + return Complex['ZERO']; + } + + const arg = Math.atan2(this['im'], this['re']); + const loh = logHypot(this['re'], this['im']); + + let re = Math.exp(z['re'] * loh - z['im'] * arg); + let im = z['im'] * loh + z['re'] * arg; + return new Complex( + re * Math.cos(im), + re * Math.sin(im)); + }, + + /** + * Calculate the complex square root + * + * @returns {Complex} + */ + 'sqrt': function () { + + const a = this['re']; + const b = this['im']; + + if (b === 0) { + // Real number case + if (a >= 0) { + return new Complex(Math.sqrt(a), 0); + } else { + return new Complex(0, Math.sqrt(-a)); + } + } + + const r = hypot(a, b); + + let re = Math.sqrt(0.5 * (r + Math.abs(a))); // sqrt(2x) / 2 = sqrt(x / 2) + let im = Math.abs(b) / (2 * re); + + if (a >= 0) { + return new Complex(re, b < 0 ? -im : im); + } else { + return new Complex(im, b < 0 ? -re : re); + } + }, + + /** + * Calculate the complex exponent + * + * @returns {Complex} + */ + 'exp': function () { + + const er = Math.exp(this['re']); + + if (this['im'] === 0) { + return new Complex(er, 0); + } + return new Complex( + er * Math.cos(this['im']), + er * Math.sin(this['im'])); + }, + + /** + * Calculate the complex exponent and subtracts one. + * + * This may be more accurate than `Complex(x).exp().sub(1)` if + * `x` is small. + * + * @returns {Complex} + */ + 'expm1': function () { + + /** + * exp(a + i*b) - 1 + = exp(a) * (cos(b) + j*sin(b)) - 1 + = expm1(a)*cos(b) + cosm1(b) + j*exp(a)*sin(b) + */ + + const a = this['re']; + const b = this['im']; + + return new Complex( + Math.expm1(a) * Math.cos(b) + cosm1(b), + Math.exp(a) * Math.sin(b)); + }, + + /** + * Calculate the natural log + * + * @returns {Complex} + */ + 'log': function () { + + const a = this['re']; + const b = this['im']; + + if (b === 0 && a > 0) { + return new Complex(Math.log(a), 0); + } + + return new Complex( + logHypot(a, b), + Math.atan2(b, a)); + }, + + /** + * Calculate the magnitude of the complex number + * + * @returns {number} + */ + 'abs': function () { + + return hypot(this['re'], this['im']); + }, + + /** + * Calculate the angle of the complex number + * + * @returns {number} + */ + 'arg': function () { + + return Math.atan2(this['im'], this['re']); + }, + + /** + * Calculate the sine of the complex number + * + * @returns {Complex} + */ + 'sin': function () { + + // sin(z) = ( e^iz - e^-iz ) / 2i + // = sin(a)cosh(b) + i cos(a)sinh(b) + + const a = this['re']; + const b = this['im']; + + return new Complex( + Math.sin(a) * cosh(b), + Math.cos(a) * sinh(b)); + }, + + /** + * Calculate the cosine + * + * @returns {Complex} + */ + 'cos': function () { + + // cos(z) = ( e^iz + e^-iz ) / 2 + // = cos(a)cosh(b) - i sin(a)sinh(b) + + const a = this['re']; + const b = this['im']; + + return new Complex( + Math.cos(a) * cosh(b), + -Math.sin(a) * sinh(b)); + }, + + /** + * Calculate the tangent + * + * @returns {Complex} + */ + 'tan': function () { + + // tan(z) = sin(z) / cos(z) + // = ( e^iz - e^-iz ) / ( i( e^iz + e^-iz ) ) + // = ( e^2iz - 1 ) / i( e^2iz + 1 ) + // = ( sin(2a) + i sinh(2b) ) / ( cos(2a) + cosh(2b) ) + + const a = 2 * this['re']; + const b = 2 * this['im']; + const d = Math.cos(a) + cosh(b); + + return new Complex( + Math.sin(a) / d, + sinh(b) / d); + }, + + /** + * Calculate the cotangent + * + * @returns {Complex} + */ + 'cot': function () { + + // cot(c) = i(e^(ci) + e^(-ci)) / (e^(ci) - e^(-ci)) + + const a = 2 * this['re']; + const b = 2 * this['im']; + const d = Math.cos(a) - cosh(b); + + return new Complex( + -Math.sin(a) / d, + sinh(b) / d); + }, + + /** + * Calculate the secant + * + * @returns {Complex} + */ + 'sec': function () { + + // sec(c) = 2 / (e^(ci) + e^(-ci)) + + const a = this['re']; + const b = this['im']; + const d = 0.5 * cosh(2 * b) + 0.5 * Math.cos(2 * a); + + return new Complex( + Math.cos(a) * cosh(b) / d, + Math.sin(a) * sinh(b) / d); + }, + + /** + * Calculate the cosecans + * + * @returns {Complex} + */ + 'csc': function () { + + // csc(c) = 2i / (e^(ci) - e^(-ci)) + + const a = this['re']; + const b = this['im']; + const d = 0.5 * cosh(2 * b) - 0.5 * Math.cos(2 * a); + + return new Complex( + Math.sin(a) * cosh(b) / d, + -Math.cos(a) * sinh(b) / d); + }, + + /** + * Calculate the complex arcus sinus + * + * @returns {Complex} + */ + 'asin': function () { + + // asin(c) = -i * log(ci + sqrt(1 - c^2)) + + const a = this['re']; + const b = this['im']; + + const t1 = new Complex( + b * b - a * a + 1, + -2 * a * b)['sqrt'](); + + const t2 = new Complex( + t1['re'] - b, + t1['im'] + a)['log'](); + + return new Complex(t2['im'], -t2['re']); + }, + + /** + * Calculate the complex arcus cosinus + * + * @returns {Complex} + */ + 'acos': function () { + + // acos(c) = i * log(c - i * sqrt(1 - c^2)) + + const a = this['re']; + const b = this['im']; + + const t1 = new Complex( + b * b - a * a + 1, + -2 * a * b)['sqrt'](); + + const t2 = new Complex( + t1['re'] - b, + t1['im'] + a)['log'](); + + return new Complex(Math.PI / 2 - t2['im'], t2['re']); + }, + + /** + * Calculate the complex arcus tangent + * + * @returns {Complex} + */ + 'atan': function () { + + // atan(c) = i / 2 log((i + x) / (i - x)) + + const a = this['re']; + const b = this['im']; + + if (a === 0) { + + if (b === 1) { + return new Complex(0, Infinity); + } + + if (b === -1) { + return new Complex(0, -Infinity); + } + } + + const d = a * a + (1.0 - b) * (1.0 - b); + + const t1 = new Complex( + (1 - b * b - a * a) / d, + -2 * a / d).log(); + + return new Complex(-0.5 * t1['im'], 0.5 * t1['re']); + }, + + /** + * Calculate the complex arcus cotangent + * + * @returns {Complex} + */ + 'acot': function () { + + // acot(c) = i / 2 log((c - i) / (c + i)) + + const a = this['re']; + const b = this['im']; + + if (b === 0) { + return new Complex(Math.atan2(1, a), 0); + } + + const d = a * a + b * b; + return (d !== 0) + ? new Complex( + a / d, + -b / d).atan() + : new Complex( + (a !== 0) ? a / 0 : 0, + (b !== 0) ? -b / 0 : 0).atan(); + }, + + /** + * Calculate the complex arcus secant + * + * @returns {Complex} + */ + 'asec': function () { + + // asec(c) = -i * log(1 / c + sqrt(1 - i / c^2)) + + const a = this['re']; + const b = this['im']; + + if (a === 0 && b === 0) { + return new Complex(0, Infinity); + } + + const d = a * a + b * b; + return (d !== 0) + ? new Complex( + a / d, + -b / d).acos() + : new Complex( + (a !== 0) ? a / 0 : 0, + (b !== 0) ? -b / 0 : 0).acos(); + }, + + /** + * Calculate the complex arcus cosecans + * + * @returns {Complex} + */ + 'acsc': function () { + + // acsc(c) = -i * log(i / c + sqrt(1 - 1 / c^2)) + + const a = this['re']; + const b = this['im']; + + if (a === 0 && b === 0) { + return new Complex(Math.PI / 2, Infinity); + } + + const d = a * a + b * b; + return (d !== 0) + ? new Complex( + a / d, + -b / d).asin() + : new Complex( + (a !== 0) ? a / 0 : 0, + (b !== 0) ? -b / 0 : 0).asin(); + }, + + /** + * Calculate the complex sinh + * + * @returns {Complex} + */ + 'sinh': function () { + + // sinh(c) = (e^c - e^-c) / 2 + + const a = this['re']; + const b = this['im']; + + return new Complex( + sinh(a) * Math.cos(b), + cosh(a) * Math.sin(b)); + }, + + /** + * Calculate the complex cosh + * + * @returns {Complex} + */ + 'cosh': function () { + + // cosh(c) = (e^c + e^-c) / 2 + + const a = this['re']; + const b = this['im']; + + return new Complex( + cosh(a) * Math.cos(b), + sinh(a) * Math.sin(b)); + }, + + /** + * Calculate the complex tanh + * + * @returns {Complex} + */ + 'tanh': function () { + + // tanh(c) = (e^c - e^-c) / (e^c + e^-c) + + const a = 2 * this['re']; + const b = 2 * this['im']; + const d = cosh(a) + Math.cos(b); + + return new Complex( + sinh(a) / d, + Math.sin(b) / d); + }, + + /** + * Calculate the complex coth + * + * @returns {Complex} + */ + 'coth': function () { + + // coth(c) = (e^c + e^-c) / (e^c - e^-c) + + const a = 2 * this['re']; + const b = 2 * this['im']; + const d = cosh(a) - Math.cos(b); + + return new Complex( + sinh(a) / d, + -Math.sin(b) / d); + }, + + /** + * Calculate the complex coth + * + * @returns {Complex} + */ + 'csch': function () { + + // csch(c) = 2 / (e^c - e^-c) + + const a = this['re']; + const b = this['im']; + const d = Math.cos(2 * b) - cosh(2 * a); + + return new Complex( + -2 * sinh(a) * Math.cos(b) / d, + 2 * cosh(a) * Math.sin(b) / d); + }, + + /** + * Calculate the complex sech + * + * @returns {Complex} + */ + 'sech': function () { + + // sech(c) = 2 / (e^c + e^-c) + + const a = this['re']; + const b = this['im']; + const d = Math.cos(2 * b) + cosh(2 * a); + + return new Complex( + 2 * cosh(a) * Math.cos(b) / d, + -2 * sinh(a) * Math.sin(b) / d); + }, + + /** + * Calculate the complex asinh + * + * @returns {Complex} + */ + 'asinh': function () { + + // asinh(c) = log(c + sqrt(c^2 + 1)) + + let tmp = this['im']; + this['im'] = -this['re']; + this['re'] = tmp; + const res = this['asin'](); + + this['re'] = -this['im']; + this['im'] = tmp; + tmp = res['re']; + + res['re'] = -res['im']; + res['im'] = tmp; + return res; + }, + + /** + * Calculate the complex acosh + * + * @returns {Complex} + */ + 'acosh': function () { + + // acosh(c) = log(c + sqrt(c^2 - 1)) + + const res = this['acos'](); + if (res['im'] <= 0) { + const tmp = res['re']; + res['re'] = -res['im']; + res['im'] = tmp; + } else { + const tmp = res['im']; + res['im'] = -res['re']; + res['re'] = tmp; + } + return res; + }, + + /** + * Calculate the complex atanh + * + * @returns {Complex} + */ + 'atanh': function () { + + // atanh(c) = log((1+c) / (1-c)) / 2 + + const a = this['re']; + const b = this['im']; + + const noIM = a > 1 && b === 0; + const oneMinus = 1 - a; + const onePlus = 1 + a; + const d = oneMinus * oneMinus + b * b; + + const x = (d !== 0) + ? new Complex( + (onePlus * oneMinus - b * b) / d, + (b * oneMinus + onePlus * b) / d) + : new Complex( + (a !== -1) ? (a / 0) : 0, + (b !== 0) ? (b / 0) : 0); + + const temp = x['re']; + x['re'] = logHypot(x['re'], x['im']) / 2; + x['im'] = Math.atan2(x['im'], temp) / 2; + if (noIM) { + x['im'] = -x['im']; + } + return x; + }, + + /** + * Calculate the complex acoth + * + * @returns {Complex} + */ + 'acoth': function () { + + // acoth(c) = log((c+1) / (c-1)) / 2 + + const a = this['re']; + const b = this['im']; + + if (a === 0 && b === 0) { + return new Complex(0, Math.PI / 2); + } + + const d = a * a + b * b; + return (d !== 0) + ? new Complex( + a / d, + -b / d).atanh() + : new Complex( + (a !== 0) ? a / 0 : 0, + (b !== 0) ? -b / 0 : 0).atanh(); + }, + + /** + * Calculate the complex acsch + * + * @returns {Complex} + */ + 'acsch': function () { + + // acsch(c) = log((1+sqrt(1+c^2))/c) + + const a = this['re']; + const b = this['im']; + + if (b === 0) { + + return new Complex( + (a !== 0) + ? Math.log(a + Math.sqrt(a * a + 1)) + : Infinity, 0); + } + + const d = a * a + b * b; + return (d !== 0) + ? new Complex( + a / d, + -b / d).asinh() + : new Complex( + (a !== 0) ? a / 0 : 0, + (b !== 0) ? -b / 0 : 0).asinh(); + }, + + /** + * Calculate the complex asech + * + * @returns {Complex} + */ + 'asech': function () { + + // asech(c) = log((1+sqrt(1-c^2))/c) + + const a = this['re']; + const b = this['im']; + + if (this['isZero']()) { + return Complex['INFINITY']; + } + + const d = a * a + b * b; + return (d !== 0) + ? new Complex( + a / d, + -b / d).acosh() + : new Complex( + (a !== 0) ? a / 0 : 0, + (b !== 0) ? -b / 0 : 0).acosh(); + }, + + /** + * Calculate the complex inverse 1/z + * + * @returns {Complex} + */ + 'inverse': function () { + + // 1 / 0 = Infinity and 1 / Infinity = 0 + if (this['isZero']()) { + return Complex['INFINITY']; + } + + if (this['isInfinite']()) { + return Complex['ZERO']; + } + + const a = this['re']; + const b = this['im']; + + const d = a * a + b * b; + + return new Complex(a / d, -b / d); + }, + + /** + * Returns the complex conjugate + * + * @returns {Complex} + */ + 'conjugate': function () { + + return new Complex(this['re'], -this['im']); + }, + + /** + * Gets the negated complex number + * + * @returns {Complex} + */ + 'neg': function () { + + return new Complex(-this['re'], -this['im']); + }, + + /** + * Ceils the actual complex number + * + * @returns {Complex} + */ + 'ceil': function (places) { + + places = Math.pow(10, places || 0); + + return new Complex( + Math.ceil(this['re'] * places) / places, + Math.ceil(this['im'] * places) / places); + }, + + /** + * Floors the actual complex number + * + * @returns {Complex} + */ + 'floor': function (places) { + + places = Math.pow(10, places || 0); + + return new Complex( + Math.floor(this['re'] * places) / places, + Math.floor(this['im'] * places) / places); + }, + + /** + * Ceils the actual complex number + * + * @returns {Complex} + */ + 'round': function (places) { + + places = Math.pow(10, places || 0); + + return new Complex( + Math.round(this['re'] * places) / places, + Math.round(this['im'] * places) / places); + }, + + /** + * Compares two complex numbers + * + * **Note:** new Complex(Infinity).equals(Infinity) === false + * + * @returns {boolean} + */ + 'equals': function (a, b) { + + const z = parse(a, b); + + return Math.abs(z['re'] - this['re']) <= Complex['EPSILON'] && + Math.abs(z['im'] - this['im']) <= Complex['EPSILON']; + }, + + /** + * Clones the actual object + * + * @returns {Complex} + */ + 'clone': function () { + + return new Complex(this['re'], this['im']); + }, + + /** + * Gets a string of the actual complex number + * + * @returns {string} + */ + 'toString': function () { + + let a = this['re']; + let b = this['im']; + let ret = ""; + + if (this['isNaN']()) { + return 'NaN'; + } + + if (this['isInfinite']()) { + return 'Infinity'; + } + + if (Math.abs(a) < Complex['EPSILON']) { + a = 0; + } + + if (Math.abs(b) < Complex['EPSILON']) { + b = 0; + } + + // If is real number + if (b === 0) { + return ret + a; + } + + if (a !== 0) { + ret += a; + ret += " "; + if (b < 0) { + b = -b; + ret += "-"; + } else { + ret += "+"; + } + ret += " "; + } else if (b < 0) { + b = -b; + ret += "-"; + } + + if (1 !== b) { // b is the absolute imaginary part + ret += b; + } + return ret + "i"; + }, + + /** + * Returns the actual number as a vector + * + * @returns {Array} + */ + 'toVector': function () { + + return [this['re'], this['im']]; + }, + + /** + * Returns the actual real value of the current object + * + * @returns {number|null} + */ + 'valueOf': function () { + + if (this['im'] === 0) { + return this['re']; + } + return null; + }, + + /** + * Determines whether a complex number is not on the Riemann sphere. + * + * @returns {boolean} + */ + 'isNaN': function () { + return isNaN(this['re']) || isNaN(this['im']); + }, + + /** + * Determines whether or not a complex number is at the zero pole of the + * Riemann sphere. + * + * @returns {boolean} + */ + 'isZero': function () { + return this['im'] === 0 && this['re'] === 0; + }, + + /** + * Determines whether a complex number is not at the infinity pole of the + * Riemann sphere. + * + * @returns {boolean} + */ + 'isFinite': function () { + return isFinite(this['re']) && isFinite(this['im']); + }, + + /** + * Determines whether or not a complex number is at the infinity pole of the + * Riemann sphere. + * + * @returns {boolean} + */ + 'isInfinite': function () { + return !this['isFinite'](); + } +}; + +Complex['ZERO'] = new Complex(0, 0); +Complex['ONE'] = new Complex(1, 0); +Complex['I'] = new Complex(0, 1); +Complex['PI'] = new Complex(Math.PI, 0); +Complex['E'] = new Complex(Math.E, 0); +Complex['INFINITY'] = new Complex(Infinity, Infinity); +Complex['NAN'] = new Complex(NaN, NaN); +Complex['EPSILON'] = 1e-15; +export { + Complex as default, Complex +}; diff --git a/node_modules/complex.js/examples/gamma.js b/node_modules/complex.js/examples/gamma.js new file mode 100644 index 0000000..1cc739d --- /dev/null +++ b/node_modules/complex.js/examples/gamma.js @@ -0,0 +1,33 @@ +/* + * A gamma function implementation based on Lanczos Approximation + * https://en.wikipedia.org/wiki/Lanczos_approximation + */ + +var Complex = require('complex.js'); + +var P = [ + Complex(0.99999999999980993), + Complex(676.5203681218851), Complex(-1259.1392167224028), Complex(771.32342877765313), + Complex(-176.61502916214059), Complex(12.507343278686905), Complex(-0.13857109526572012), + Complex(9.9843695780195716e-6), Complex(1.5056327351493116e-7) +]; + +var SQRT2PI = Complex(Math.sqrt(2 * Math.PI)); + +function gamma(z) { + + z = z.sub(1); + + var x = P[0]; + var t = z.add(7.5); + for (var i = 1; i < P.length; i++) { + x = x.add(P[i].div(z.add(i))); + } + return SQRT2PI.mul(t.pow(z.add(0.5))).mul(t.neg().exp()).mul(x); +} + +var fac = 1; +for (var i = 1; i <= 10; i++) { + console.log(fac, gamma(Complex(i))); + fac *= i; +} diff --git a/node_modules/complex.js/package.json b/node_modules/complex.js/package.json index 4203d40..bc486a3 100644 --- a/node_modules/complex.js/package.json +++ b/node_modules/complex.js/package.json @@ -1,86 +1,60 @@ { - "_from": "complex.js@^2.2.5", - "_id": "complex.js@2.4.2", - "_inBundle": false, - "_integrity": "sha512-qtx7HRhPGSCBtGiST4/WGHuW+zeaND/6Ld+db6PbrulIB1i2Ev/2UPiqcmpQNPSyfBKraC0EOvOKCB5dGZKt3g==", - "_location": "/complex.js", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "complex.js@^2.2.5", "name": "complex.js", - "escapedName": "complex.js", - "rawSpec": "^2.2.5", - "saveSpec": null, - "fetchSpec": "^2.2.5" - }, - "_requiredBy": [ - "/mathjs" - ], - "_resolved": "https://registry.npmmirror.com/complex.js/-/complex.js-2.4.2.tgz", - "_shasum": "76f260a9e7e232d8ad26348484a9b128c13fcc9a", - "_spec": "complex.js@^2.2.5", - "_where": "D:\\jiangchengfeiyi-xiaochengxu\\node_modules\\mathjs", - "author": { - "name": "Robert Eisele", - "email": "robert@raw.org", - "url": "https://raw.org/" - }, - "browser": "./dist/complex.min.js", - "bugs": { - "url": "https://github.com/rawify/Complex.js/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "A complex numbers library", - "devDependencies": { - "crude-build": "^0.1.2", - "mocha": "*" - }, - "directories": { - "example": "examples", - "test": "tests" - }, - "engines": { - "node": "*" - }, - "exports": { - ".": { - "types": "./complex.d.ts", - "require": "./dist/complex.js", - "import": "./dist/complex.mjs" + "title": "Complex.js", + "version": "2.4.2", + "homepage": "https://raw.org/article/complex-numbers-in-javascript/", + "bugs": "https://github.com/rawify/Complex.js/issues", + "description": "A complex numbers library", + "keywords": [ + "complex numbers", + "math", + "complex", + "number", + "calculus", + "parser", + "arithmetic" + ], + "private": false, + "main": "./dist/complex.js", + "module": "./dist/complex.mjs", + "types": "./complex.d.ts", + "browser": "./dist/complex.min.js", + "unpkg": "./dist/complex.min.js", + "readmeFilename": "README.md", + "exports": { + ".": { + "types": "./complex.d.ts", + "require": "./dist/complex.js", + "import": "./dist/complex.mjs" + } + }, + "repository": { + "type": "git", + "url": "git@github.com:rawify/Complex.js.git" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/rawify" + }, + "author": { + "name": "Robert Eisele", + "email": "robert@raw.org", + "url": "https://raw.org/" + }, + "license": "MIT", + "engines": { + "node": "*" + }, + "directories": { + "example": "examples", + "test": "tests" + }, + "scripts": { + "build": "crude-build Complex", + "test": "mocha tests/*.js" + }, + "devDependencies": { + "crude-build": "^0.1.2", + "mocha": "*" } - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/rawify" - }, - "homepage": "https://raw.org/article/complex-numbers-in-javascript/", - "keywords": [ - "complex numbers", - "math", - "complex", - "number", - "calculus", - "parser", - "arithmetic" - ], - "license": "MIT", - "main": "./dist/complex.js", - "module": "./dist/complex.mjs", - "name": "complex.js", - "private": false, - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/rawify/Complex.js.git" - }, - "scripts": { - "build": "crude-build Complex", - "test": "mocha tests/*.js" - }, - "title": "Complex.js", - "types": "./complex.d.ts", - "unpkg": "./dist/complex.min.js", - "version": "2.4.2" } diff --git a/node_modules/decimal.js/package.json b/node_modules/decimal.js/package.json index 6254961..4b59cd6 100644 --- a/node_modules/decimal.js/package.json +++ b/node_modules/decimal.js/package.json @@ -1,38 +1,28 @@ { - "_from": "decimal.js@^10.4.3", - "_id": "decimal.js@10.4.3", - "_inBundle": false, - "_integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==", - "_location": "/decimal.js", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "decimal.js@^10.4.3", - "name": "decimal.js", - "escapedName": "decimal.js", - "rawSpec": "^10.4.3", - "saveSpec": null, - "fetchSpec": "^10.4.3" - }, - "_requiredBy": [ - "/mathjs" - ], - "_resolved": "https://registry.npmmirror.com/decimal.js/-/decimal.js-10.4.3.tgz", - "_shasum": "1044092884d245d1b7f65725fa4ad4c6f781cc23", - "_spec": "decimal.js@^10.4.3", - "_where": "D:\\jiangchengfeiyi-xiaochengxu\\node_modules\\mathjs", - "author": { - "name": "Michael Mclaughlin", - "email": "M8ch88l@gmail.com" - }, - "browser": "decimal.js", - "bugs": { - "url": "https://github.com/MikeMcl/decimal.js/issues" - }, - "bundleDependencies": false, - "deprecated": false, + "name": "decimal.js", "description": "An arbitrary-precision Decimal type for JavaScript.", + "version": "10.4.3", + "keywords": [ + "arbitrary", + "precision", + "arithmetic", + "big", + "number", + "decimal", + "float", + "biginteger", + "bigdecimal", + "bignumber", + "bigint", + "bignum" + ], + "repository" : { + "type": "git", + "url": "https://github.com/MikeMcl/decimal.js.git" + }, + "main": "decimal", + "module": "decimal.mjs", + "browser": "decimal.js", "exports": { ".": { "types": "./decimal.d.ts", @@ -48,37 +38,18 @@ "require": "./decimal.js" } }, - "files": [ - "decimal.js", - "decimal.mjs", - "decimal.d.ts" - ], - "homepage": "https://github.com/MikeMcl/decimal.js#readme", - "keywords": [ - "arbitrary", - "precision", - "arithmetic", - "big", - "number", - "decimal", - "float", - "biginteger", - "bigdecimal", - "bignumber", - "bigint", - "bignum" - ], - "license": "MIT", - "main": "decimal", - "module": "decimal.mjs", - "name": "decimal.js", - "repository": { - "type": "git", - "url": "git+https://github.com/MikeMcl/decimal.js.git" + "author": { + "name": "Michael Mclaughlin", + "email": "M8ch88l@gmail.com" }, + "license": "MIT", "scripts": { "test": "node ./test/test.js" }, "types": "decimal.d.ts", - "version": "10.4.3" + "files": [ + "decimal.js", + "decimal.mjs", + "decimal.d.ts" + ] } diff --git a/node_modules/escape-latex/package.json b/node_modules/escape-latex/package.json index e89186b..a57945d 100644 --- a/node_modules/escape-latex/package.json +++ b/node_modules/escape-latex/package.json @@ -1,36 +1,41 @@ { - "_from": "escape-latex@^1.2.0", - "_id": "escape-latex@1.2.0", - "_inBundle": false, - "_integrity": "sha512-nV5aVWW1K0wEiUIEdZ4erkGGH8mDxGyxSeqPzRNtWP7ataw+/olFObw7hujFWlVjNsaDFw5VZ5NzVSIqRgfTiw==", - "_location": "/escape-latex", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "escape-latex@^1.2.0", - "name": "escape-latex", - "escapedName": "escape-latex", - "rawSpec": "^1.2.0", - "saveSpec": null, - "fetchSpec": "^1.2.0" - }, - "_requiredBy": [ - "/mathjs" - ], - "_resolved": "https://registry.npmmirror.com/escape-latex/-/escape-latex-1.2.0.tgz", - "_shasum": "07c03818cf7dac250cce517f4fda1b001ef2bca1", - "_spec": "escape-latex@^1.2.0", - "_where": "D:\\jiangchengfeiyi-xiaochengxu\\node_modules\\mathjs", - "author": { - "name": "Dang Mai" - }, - "bugs": { - "url": "https://github.com/dangmai/escape-latex/issues" - }, - "bundleDependencies": false, - "deprecated": false, + "name": "escape-latex", + "version": "1.2.0", "description": "Escape LaTeX special characters with Javascript", + "main": "./dist/index.js", + "files": ["dist"], + "scripts": { + "test": "mocha --require babel-core/register -u tdd ./src/**/*.test.js", + "preversion": "npm test && npm run build", + "postversion": "git push && git push --tags", + "precommit": "npm run lint && lint-staged", + "prettier": "prettier --write ./src/**/*.js", + "lint": "eslint ./src", + "init": "mkdir dist", + "clean": "rm -rf dist", + "prebuild": "npm run clean && npm run init", + "build": "babel ./src -d ./dist --ignore index.test.js" + }, + "lint-staged": { + "*.{js,json,css,md}": ["npm run prettier", "git add"] + }, + "eslintConfig": { + "parserOptions": { + "ecmaVersion": 8 + }, + "extends": ["eslint:recommended", "google", "prettier"], + "env": { + "node": "true" + } + }, + "prettier": { + "trailingComma": "all" + }, + "repository": { + "type": "git", + "url": "https://github.com/dangmai/escape-latex" + }, + "keywords": ["latex", "escape"], "devDependencies": { "babel-cli": "^6.26.0", "babel-core": "^6.26.0", @@ -45,54 +50,6 @@ "mocha": "^5.0.0", "prettier": "^1.9.2" }, - "eslintConfig": { - "parserOptions": { - "ecmaVersion": 8 - }, - "extends": [ - "eslint:recommended", - "google", - "prettier" - ], - "env": { - "node": "true" - } - }, - "files": [ - "dist" - ], - "homepage": "https://github.com/dangmai/escape-latex#readme", - "keywords": [ - "latex", - "escape" - ], - "license": "MIT", - "lint-staged": { - "*.{js,json,css,md}": [ - "npm run prettier", - "git add" - ] - }, - "main": "./dist/index.js", - "name": "escape-latex", - "prettier": { - "trailingComma": "all" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/dangmai/escape-latex.git" - }, - "scripts": { - "build": "babel ./src -d ./dist --ignore index.test.js", - "clean": "rm -rf dist", - "init": "mkdir dist", - "lint": "eslint ./src", - "postversion": "git push && git push --tags", - "prebuild": "npm run clean && npm run init", - "precommit": "npm run lint && lint-staged", - "prettier": "prettier --write ./src/**/*.js", - "preversion": "npm test && npm run build", - "test": "mocha --require babel-core/register -u tdd ./src/**/*.test.js" - }, - "version": "1.2.0" + "author": "Dang Mai", + "license": "MIT" } diff --git a/node_modules/fraction.js/package.json b/node_modules/fraction.js/package.json index d0fa5bb..e7d8268 100644 --- a/node_modules/fraction.js/package.json +++ b/node_modules/fraction.js/package.json @@ -1,62 +1,10 @@ { - "_from": "fraction.js@^5.2.1", - "_id": "fraction.js@5.2.1", - "_inBundle": false, - "_integrity": "sha512-Ah6t/7YCYjrPUFUFsOsRLMXAdnYM+aQwmojD2Ayb/Ezr82SwES0vuyQ8qZ3QO8n9j7W14VJuVZZet8U3bhSdQQ==", - "_location": "/fraction.js", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "fraction.js@^5.2.1", - "name": "fraction.js", - "escapedName": "fraction.js", - "rawSpec": "^5.2.1", - "saveSpec": null, - "fetchSpec": "^5.2.1" - }, - "_requiredBy": [ - "/mathjs" - ], - "_resolved": "https://registry.npmmirror.com/fraction.js/-/fraction.js-5.2.1.tgz", - "_shasum": "93ffc9507b1a68a1271883aa28e98f58a1c0c6b3", - "_spec": "fraction.js@^5.2.1", - "_where": "D:\\jiangchengfeiyi-xiaochengxu\\node_modules\\mathjs", - "author": { - "name": "Robert Eisele", - "email": "robert@raw.org", - "url": "https://raw.org/" - }, - "browser": "./dist/fraction.min.js", - "bugs": { - "url": "https://github.com/rawify/Fraction.js/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "A rational numbers library", - "devDependencies": { - "crude-build": "^0.1.2", - "mocha": "*" - }, - "directories": { - "example": "examples", - "test": "tests" - }, - "engines": { - "node": ">= 12" - }, - "exports": { - ".": { - "types": "./fraction.d.ts", - "require": "./dist/fraction.js", - "import": "./dist/fraction.mjs" - } - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/rawify" - }, + "name": "fraction.js", + "title": "Fraction.js", + "version": "5.2.1", "homepage": "https://raw.org/article/rational-numbers-in-javascript/", + "bugs": "https://github.com/rawify/Fraction.js/issues", + "description": "A rational numbers library", "keywords": [ "math", "numbers", @@ -75,21 +23,47 @@ "denominator", "simplification" ], - "license": "MIT", + "private": false, "main": "./dist/fraction.js", "module": "./dist/fraction.mjs", - "name": "fraction.js", - "private": false, + "types": "./fraction.d.ts", + "browser": "./dist/fraction.min.js", + "unpkg": "./dist/fraction.min.js", + "readmeFilename": "README.md", + "exports": { + ".": { + "types": "./fraction.d.ts", + "require": "./dist/fraction.js", + "import": "./dist/fraction.mjs" + } + }, "repository": { "type": "git", - "url": "git+ssh://git@github.com/rawify/Fraction.js.git" + "url": "git@github.com:rawify/Fraction.js.git" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/rawify" + }, + "author": { + "name": "Robert Eisele", + "email": "robert@raw.org", + "url": "https://raw.org/" + }, + "license": "MIT", + "engines": { + "node": ">= 12" + }, + "directories": { + "example": "examples", + "test": "tests" }, "scripts": { "build": "crude-build Fraction", "test": "mocha tests/*.js" }, - "title": "Fraction.js", - "types": "./fraction.d.ts", - "unpkg": "./dist/fraction.min.js", - "version": "5.2.1" + "devDependencies": { + "crude-build": "^0.1.2", + "mocha": "*" + } } diff --git a/node_modules/javascript-natural-sort/package.json b/node_modules/javascript-natural-sort/package.json index f72c029..4b1bf07 100644 --- a/node_modules/javascript-natural-sort/package.json +++ b/node_modules/javascript-natural-sort/package.json @@ -1,38 +1,15 @@ { - "_from": "javascript-natural-sort@^0.7.1", - "_id": "javascript-natural-sort@0.7.1", - "_inBundle": false, - "_integrity": "sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw==", - "_location": "/javascript-natural-sort", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "javascript-natural-sort@^0.7.1", - "name": "javascript-natural-sort", - "escapedName": "javascript-natural-sort", - "rawSpec": "^0.7.1", - "saveSpec": null, - "fetchSpec": "^0.7.1" - }, - "_requiredBy": [ - "/mathjs" - ], - "_resolved": "https://registry.npmmirror.com/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz", - "_shasum": "f9e2303d4507f6d74355a73664d1440fb5a0ef59", - "_spec": "javascript-natural-sort@^0.7.1", - "_where": "D:\\jiangchengfeiyi-xiaochengxu\\node_modules\\mathjs", - "author": { - "name": "Jim Palmer", - "url": "based on chunking idea from Dave Koelle, packaged by @khous of Bill4Time" - }, - "bugs": { - "url": "https://github.com/Bill4Time/javascript-natural-sort/issues" - }, - "bundleDependencies": false, - "deprecated": false, + "name": "javascript-natural-sort", + "version": "0.7.1", "description": "Natural Sort algorithm for Javascript - Version 0.7 - Released under MIT license", - "homepage": "https://github.com/Bill4Time/javascript-natural-sort", + "main": "naturalSort.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/Bill4Time/javascript-natural-sort.git" + }, "keywords": [ "natural", "sort", @@ -41,15 +18,10 @@ "sort", "sorting" ], + "author": "Jim Palmer (based on chunking idea from Dave Koelle, packaged by @khous of Bill4Time)", "license": "MIT", - "main": "naturalSort.js", - "name": "javascript-natural-sort", - "repository": { - "type": "git", - "url": "git+https://github.com/Bill4Time/javascript-natural-sort.git" + "bugs": { + "url": "https://github.com/Bill4Time/javascript-natural-sort/issues" }, - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "version": "0.7.1" + "homepage": "https://github.com/Bill4Time/javascript-natural-sort" } diff --git a/node_modules/mathjs/package.json b/node_modules/mathjs/package.json index dacca69..49006cb 100644 --- a/node_modules/mathjs/package.json +++ b/node_modules/mathjs/package.json @@ -1,40 +1,29 @@ { - "_from": "mathjs", - "_id": "mathjs@14.0.1", - "_inBundle": false, - "_integrity": "sha512-yyJgLwC6UXuve724np8tHRMYaTtb5UqiOGQkjwbSXgH8y1C/LcJ0pvdNDZLI2LT7r+iExh2Y5HwfAY+oZFtGIQ==", - "_location": "/mathjs", - "_phantomChildren": {}, - "_requested": { - "type": "tag", - "registry": true, - "raw": "mathjs", - "name": "mathjs", - "escapedName": "mathjs", - "rawSpec": "", - "saveSpec": null, - "fetchSpec": "latest" + "name": "mathjs", + "version": "14.0.1", + "description": "Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with different data types like numbers, big numbers, complex numbers, fractions, units, and matrices.", + "author": "Jos de Jong (https://github.com/josdejong)", + "homepage": "https://mathjs.org", + "repository": { + "type": "git", + "url": "https://github.com/josdejong/mathjs.git" }, - "_requiredBy": [ - "#USER", - "/" + "license": "Apache-2.0", + "keywords": [ + "math", + "mathematics", + "functions", + "numeric", + "algebra", + "parser", + "expression", + "number", + "bignumber", + "complex", + "fraction", + "matrix", + "unit" ], - "_resolved": "https://registry.npmmirror.com/mathjs/-/mathjs-14.0.1.tgz", - "_shasum": "b47233a3e0913ae3d2669d67f4edf7a5b6fe1fb1", - "_spec": "mathjs", - "_where": "D:\\jiangchengfeiyi-xiaochengxu", - "author": { - "name": "Jos de Jong", - "email": "wjosdejong@gmail.com", - "url": "https://github.com/josdejong" - }, - "bin": { - "mathjs": "bin/cli.js" - }, - "bugs": { - "url": "https://github.com/josdejong/mathjs/issues" - }, - "bundleDependencies": false, "dependencies": { "@babel/runtime": "^7.25.7", "complex.js": "^2.2.5", @@ -46,8 +35,6 @@ "tiny-emitter": "^2.1.0", "typed-function": "^4.2.1" }, - "deprecated": false, - "description": "Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with different data types like numbers, big numbers, complex numbers, fractions, units, and matrices.", "devDependencies": { "@babel/core": "7.26.0", "@babel/plugin-transform-object-assign": "7.25.9", @@ -108,13 +95,12 @@ "webpack": "5.97.1", "zeros": "1.0.0" }, - "directories": { - "bin": "./bin", - "lib": "./lib" - }, - "engines": { - "node": ">= 18" - }, + "type": "module", + "main": "./lib/cjs", + "types": "./types/index.d.ts", + "module": "./lib/esm", + "unpkg": "./lib/browser/math.js", + "jsdelivr": "./lib/browser/math.js", "exports": { ".": { "types": "./types/index.d.ts", @@ -145,30 +131,9 @@ "HISTORY.md", "CONTRIBUTING.md" ], - "homepage": "https://mathjs.org", - "jsdelivr": "./lib/browser/math.js", - "keywords": [ - "math", - "mathematics", - "functions", - "numeric", - "algebra", - "parser", - "expression", - "number", - "bignumber", - "complex", - "fraction", - "matrix", - "unit" - ], - "license": "Apache-2.0", - "main": "./lib/cjs", - "module": "./lib/esm", - "name": "mathjs", - "repository": { - "type": "git", - "url": "git+https://github.com/josdejong/mathjs.git" + "directories": { + "bin": "./bin", + "lib": "./lib" }, "scripts": { "build": "gulp && npm run update-authors", @@ -176,25 +141,30 @@ "build:clean": "gulp clean", "build:docs": "gulp docs", "compile": "gulp compile", - "coverage": "c8 --reporter=lcov --reporter=text-summary mocha test/unit-tests && echo \"\nDetailed coverage report is available at ./coverage/lcov-report/index.html\"", - "format": "npm run lint -- --fix", + "watch": "gulp watch", "lint": "eslint --cache --max-warnings 0 src/ test/ types/", - "prepublishOnly": "npm run test:all && npm run lint", + "format": "npm run lint -- --fix", + "validate:ascii": "gulp validate:ascii", "test": "npm run test:src && npm run lint", + "test:src": "mocha test/unit-tests", + "test:generated": "mocha test/generated-code-tests", + "test:node": "mocha test/node-tests/*.test.js test/node-tests/**/*.test.js", "test:all": "npm run test:src && npm run test:generated && npm run test:node && npm run test:types", "test:browser": "karma start test/browser-test-config/local-karma.js", "test:browserstack": "karma start test/browser-test-config/browserstack-karma.js", - "test:generated": "mocha test/generated-code-tests", - "test:node": "mocha test/node-tests/*.test.js test/node-tests/**/*.test.js", - "test:src": "mocha test/unit-tests", "test:types": " tsc -p ./tsconfig.json && node --loader ts-node/esm ./test/typescript-tests/testTypes.ts", - "update-authors": "node ./tools/update-authors.js", - "validate:ascii": "gulp validate:ascii", - "watch": "gulp watch" + "coverage": "c8 --reporter=lcov --reporter=text-summary mocha test/unit-tests && echo \"\nDetailed coverage report is available at ./coverage/lcov-report/index.html\"", + "prepublishOnly": "npm run test:all && npm run lint", + "update-authors": "node ./tools/update-authors.js" }, - "sideEffects": false, - "type": "module", - "types": "./types/index.d.ts", - "unpkg": "./lib/browser/math.js", - "version": "14.0.1" + "bin": { + "mathjs": "./bin/cli.js" + }, + "engines": { + "node": ">= 18" + }, + "bugs": { + "url": "https://github.com/josdejong/mathjs/issues" + }, + "sideEffects": false } diff --git a/node_modules/regenerator-runtime/package.json b/node_modules/regenerator-runtime/package.json index da7b68c..503086f 100644 --- a/node_modules/regenerator-runtime/package.json +++ b/node_modules/regenerator-runtime/package.json @@ -1,47 +1,19 @@ { - "_from": "regenerator-runtime@^0.14.0", - "_id": "regenerator-runtime@0.14.1", - "_inBundle": false, - "_integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", - "_location": "/regenerator-runtime", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "regenerator-runtime@^0.14.0", - "name": "regenerator-runtime", - "escapedName": "regenerator-runtime", - "rawSpec": "^0.14.0", - "saveSpec": null, - "fetchSpec": "^0.14.0" - }, - "_requiredBy": [ - "/@babel/runtime" - ], - "_resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", - "_shasum": "356ade10263f685dda125100cd862c1db895327f", - "_spec": "regenerator-runtime@^0.14.0", - "_where": "D:\\jiangchengfeiyi-xiaochengxu\\node_modules\\@babel\\runtime", - "author": { - "name": "Ben Newman", - "email": "bn@cs.stanford.edu" - }, - "bundleDependencies": false, - "deprecated": false, + "name": "regenerator-runtime", + "author": "Ben Newman ", "description": "Runtime for Regenerator-compiled generator and async functions.", + "version": "0.14.1", + "main": "runtime.js", "keywords": [ "regenerator", "runtime", "generator", "async" ], - "license": "MIT", - "main": "runtime.js", - "name": "regenerator-runtime", + "sideEffects": true, "repository": { "type": "git", "url": "https://github.com/facebook/regenerator/tree/main/packages/runtime" }, - "sideEffects": true, - "version": "0.14.1" + "license": "MIT" } diff --git a/node_modules/seedrandom/package.json b/node_modules/seedrandom/package.json index 30cd866..86aad13 100644 --- a/node_modules/seedrandom/package.json +++ b/node_modules/seedrandom/package.json @@ -1,37 +1,28 @@ { - "_from": "seedrandom@^3.0.5", - "_id": "seedrandom@3.0.5", - "_inBundle": false, - "_integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==", - "_location": "/seedrandom", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "seedrandom@^3.0.5", - "name": "seedrandom", - "escapedName": "seedrandom", - "rawSpec": "^3.0.5", - "saveSpec": null, - "fetchSpec": "^3.0.5" - }, - "_requiredBy": [ - "/mathjs" + "name": "seedrandom", + "version": "3.0.5", + "description": "Seeded random number generator for Javascript.", + "main": "index.js", + "jsdelivr": "seedrandom.min.js", + "unpkg": "seedrandom.min.js", + "keywords": [ + "seed", + "random", + "crypto" ], - "_resolved": "https://registry.npmmirror.com/seedrandom/-/seedrandom-3.0.5.tgz", - "_shasum": "54edc85c95222525b0c7a6f6b3543d8e0b3aa0a7", - "_spec": "seedrandom@^3.0.5", - "_where": "D:\\jiangchengfeiyi-xiaochengxu\\node_modules\\mathjs", - "author": { - "name": "David Bau" + "scripts": { + "test": "grunt travis" }, - "browser": { - "crypto": false + "repository": { + "type": "git", + "url": "git://github.com/davidbau/seedrandom.git" }, + "author": "David Bau", + "license": "MIT", "bugs": { "url": "https://github.com/davidbau/seedrandom/issues" }, - "bundleDependencies": false, + "homepage": "http://davidbau.com/archives/2010/01/30/random_seeds_coded_hints_and_quintillions.html", "config": { "blanket": { "pattern": [ @@ -45,43 +36,25 @@ ] } }, - "deprecated": false, - "description": "Seeded random number generator for Javascript.", + "browser": { + "crypto": false + }, "devDependencies": { "blanket": "latest", "coveralls": "latest", "grunt": "latest", "grunt-browserify": "latest", + "grunt-release": "davidbau/grunt-release", "grunt-cli": "latest", "grunt-contrib-connect": "latest", "grunt-contrib-copy": "latest", "grunt-contrib-qunit": "latest", "grunt-contrib-uglify": "latest", "grunt-mocha-nyc": "latest", - "grunt-release": "github:davidbau/grunt-release", "mocha": "latest", "nyc": "latest", "proxyquire": "latest", "qunit": "latest", "requirejs": "latest" - }, - "homepage": "http://davidbau.com/archives/2010/01/30/random_seeds_coded_hints_and_quintillions.html", - "jsdelivr": "seedrandom.min.js", - "keywords": [ - "seed", - "random", - "crypto" - ], - "license": "MIT", - "main": "index.js", - "name": "seedrandom", - "repository": { - "type": "git", - "url": "git://github.com/davidbau/seedrandom.git" - }, - "scripts": { - "test": "grunt travis" - }, - "unpkg": "seedrandom.min.js", - "version": "3.0.5" + } } diff --git a/node_modules/tiny-emitter/package.json b/node_modules/tiny-emitter/package.json index eec5539..5da6335 100644 --- a/node_modules/tiny-emitter/package.json +++ b/node_modules/tiny-emitter/package.json @@ -1,44 +1,20 @@ { - "_from": "tiny-emitter@^2.1.0", - "_id": "tiny-emitter@2.1.0", - "_inBundle": false, - "_integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==", - "_location": "/tiny-emitter", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "tiny-emitter@^2.1.0", - "name": "tiny-emitter", - "escapedName": "tiny-emitter", - "rawSpec": "^2.1.0", - "saveSpec": null, - "fetchSpec": "^2.1.0" - }, - "_requiredBy": [ - "/mathjs" - ], - "_resolved": "https://registry.npmmirror.com/tiny-emitter/-/tiny-emitter-2.1.0.tgz", - "_shasum": "1d1a56edfc51c43e863cbb5382a72330e3555423", - "_spec": "tiny-emitter@^2.1.0", - "_where": "D:\\jiangchengfeiyi-xiaochengxu\\node_modules\\mathjs", - "author": { - "name": "Scott Corgan" - }, - "bugs": { - "url": "https://github.com/scottcorgan/tiny-emitter/issues" - }, - "bundleDependencies": false, - "deprecated": false, + "name": "tiny-emitter", + "version": "2.1.0", "description": "A tiny (less than 1k) event emitter library", - "devDependencies": { - "@tap-format/spec": "0.2.0", - "browserify": "11.2.0", - "tape": "4.2.1", - "testling": "1.7.1", - "uglify-js": "2.5.0" + "main": "index.js", + "scripts": { + "test-node": "tape test/index.js | tap-format-spec", + "test": "testling | tap-format-spec", + "bundle": "node_modules/.bin/browserify index.js > dist/tinyemitter.js -s TinyEmitter && echo 'Bundled'", + "minify": "node_modules/.bin/uglifyjs dist/tinyemitter.js -o dist/tinyemitter.min.js -m && echo 'Minified'", + "build": "npm test && npm run bundle && npm run minify", + "size": "node_modules/.bin/uglifyjs index.js -o minified.js -m && ls -l && rm minified.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/scottcorgan/tiny-emitter.git" }, - "homepage": "https://github.com/scottcorgan/tiny-emitter#readme", "keywords": [ "event", "emitter", @@ -47,20 +23,17 @@ "events", "bind" ], + "author": "Scott Corgan", "license": "MIT", - "main": "index.js", - "name": "tiny-emitter", - "repository": { - "type": "git", - "url": "git+https://github.com/scottcorgan/tiny-emitter.git" + "bugs": { + "url": "https://github.com/scottcorgan/tiny-emitter/issues" }, - "scripts": { - "build": "npm test && npm run bundle && npm run minify", - "bundle": "browserify index.js > dist/tinyemitter.js -s TinyEmitter && echo 'Bundled'", - "minify": "uglifyjs dist/tinyemitter.js -o dist/tinyemitter.min.js -m && echo 'Minified'", - "size": "uglifyjs index.js -o minified.js -m && ls -l && rm minified.js", - "test": "testling | tap-format-spec", - "test-node": "tape test/index.js | tap-format-spec" + "devDependencies": { + "@tap-format/spec": "0.2.0", + "browserify": "11.2.0", + "tape": "4.2.1", + "testling": "1.7.1", + "uglify-js": "2.5.0" }, "testling": { "files": [ @@ -76,6 +49,5 @@ "iphone/6.0..latest", "android-browser/4.2..latest" ] - }, - "version": "2.1.0" + } } diff --git a/node_modules/typed-function/package.json b/node_modules/typed-function/package.json index 0d964ff..e168d7b 100644 --- a/node_modules/typed-function/package.json +++ b/node_modules/typed-function/package.json @@ -1,49 +1,44 @@ { - "_from": "typed-function@^4.2.1", - "_id": "typed-function@4.2.1", - "_inBundle": false, - "_integrity": "sha512-EGjWssW7Tsk4DGfE+5yluuljS1OGYWiI1J6e8puZz9nTMM51Oug8CD5Zo4gWMsOhq5BI+1bF+rWTm4Vbj3ivRA==", - "_location": "/typed-function", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "typed-function@^4.2.1", - "name": "typed-function", - "escapedName": "typed-function", - "rawSpec": "^4.2.1", - "saveSpec": null, - "fetchSpec": "^4.2.1" - }, - "_requiredBy": [ - "/mathjs" - ], - "_resolved": "https://registry.npmmirror.com/typed-function/-/typed-function-4.2.1.tgz", - "_shasum": "19aa51847aa2dea9ef5e7fb7641c060179a74426", - "_spec": "typed-function@^4.2.1", - "_where": "D:\\jiangchengfeiyi-xiaochengxu\\node_modules\\mathjs", - "author": { - "name": "Jos de Jong", - "email": "wjosdejong@gmail.com", - "url": "https://github.com/josdejong" - }, - "browser": "lib/umd/typed-function.js", - "bugs": { - "url": "https://github.com/josdejong/typed-function/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Glen Whitney", - "url": "https://github.com/gwhitney" - }, - { - "name": "Luke Gumbley", - "url": "https://github.com/luke-gumbley" - } - ], - "deprecated": false, + "name": "typed-function", + "version": "4.2.1", "description": "Type checking for JavaScript functions", + "author": "Jos de Jong (https://github.com/josdejong)", + "contributors": [ + "Glen Whitney (https://github.com/gwhitney)", + "Luke Gumbley (https://github.com/luke-gumbley)" + ], + "homepage": "https://github.com/josdejong/typed-function", + "repository": { + "type": "git", + "url": "https://github.com/josdejong/typed-function.git" + }, + "keywords": [ + "typed", + "function", + "arguments", + "compose", + "types" + ], + "type": "module", + "main": "lib/umd/typed-function.js", + "module": "lib/esm/typed-function.mjs", + "browser": "lib/umd/typed-function.js", + "scripts": { + "test": "mocha test --recursive", + "test:lib": "mocha test test-lib --recursive", + "build": "npm-run-all build:**", + "build:clean": "del-cli lib", + "build:esm": "babel src --out-dir lib/esm --out-file-extension .mjs --source-maps --config-file ./babel.config.json", + "build:umd": "rollup lib/esm/typed-function.mjs --format umd --name 'typed' --sourcemap --output.file lib/umd/typed-function.js && cpy tools/cjs/package.json lib/umd --flat", + "build-and-test": "npm run lint && npm run build && npm run test:lib", + "lint": "eslint --cache src/**/*.mjs test/**/*.mjs test-lib/**/*.mjs", + "format": "npm run lint -- --fix", + "coverage": "c8 --reporter=lcov --reporter=text-summary mocha test --recursive && echo \"\nCoverage report is available at ./coverage/lcov-report/index.html\"", + "prepublishOnly": "npm run build-and-test" + }, + "engines": { + "node": ">= 18" + }, "devDependencies": { "@babel/cli": "7.24.6", "@babel/preset-env": "7.24.6", @@ -61,43 +56,10 @@ "pad-right": "0.2.2", "rollup": "4.18.0" }, - "engines": { - "node": ">= 18" - }, "files": [ "README.md", "LICENSE.md", "lib" ], - "homepage": "https://github.com/josdejong/typed-function", - "keywords": [ - "typed", - "function", - "arguments", - "compose", - "types" - ], - "license": "MIT", - "main": "lib/umd/typed-function.js", - "module": "lib/esm/typed-function.mjs", - "name": "typed-function", - "repository": { - "type": "git", - "url": "git+https://github.com/josdejong/typed-function.git" - }, - "scripts": { - "build": "npm-run-all build:**", - "build-and-test": "npm run lint && npm run build && npm run test:lib", - "build:clean": "del-cli lib", - "build:esm": "babel src --out-dir lib/esm --out-file-extension .mjs --source-maps --config-file ./babel.config.json", - "build:umd": "rollup lib/esm/typed-function.mjs --format umd --name 'typed' --sourcemap --output.file lib/umd/typed-function.js && cpy tools/cjs/package.json lib/umd --flat", - "coverage": "c8 --reporter=lcov --reporter=text-summary mocha test --recursive && echo \"\nCoverage report is available at ./coverage/lcov-report/index.html\"", - "format": "npm run lint -- --fix", - "lint": "eslint --cache src/**/*.mjs test/**/*.mjs test-lib/**/*.mjs", - "prepublishOnly": "npm run build-and-test", - "test": "mocha test --recursive", - "test:lib": "mocha test test-lib --recursive" - }, - "type": "module", - "version": "4.2.1" -} + "license": "MIT" +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 5180adc..d69d89b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,45 +1,69 @@ { + "name": "jiangchengfeiyi-xiaochengxu", + "lockfileVersion": 3, "requires": true, - "lockfileVersion": 1, - "dependencies": { - "@babel/runtime": { + "packages": { + "": { + "dependencies": { + "mathjs": "^14.0.1", + "mitt": "^3.0.1" + } + }, + "node_modules/@babel/runtime": { "version": "7.26.0", "resolved": "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.26.0.tgz", "integrity": "sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==", - "requires": { + "dependencies": { "regenerator-runtime": "^0.14.0" + }, + "engines": { + "node": ">=6.9.0" } }, - "complex.js": { + "node_modules/complex.js": { "version": "2.4.2", "resolved": "https://registry.npmmirror.com/complex.js/-/complex.js-2.4.2.tgz", - "integrity": "sha512-qtx7HRhPGSCBtGiST4/WGHuW+zeaND/6Ld+db6PbrulIB1i2Ev/2UPiqcmpQNPSyfBKraC0EOvOKCB5dGZKt3g==" + "integrity": "sha512-qtx7HRhPGSCBtGiST4/WGHuW+zeaND/6Ld+db6PbrulIB1i2Ev/2UPiqcmpQNPSyfBKraC0EOvOKCB5dGZKt3g==", + "engines": { + "node": "*" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/rawify" + } }, - "decimal.js": { + "node_modules/decimal.js": { "version": "10.4.3", "resolved": "https://registry.npmmirror.com/decimal.js/-/decimal.js-10.4.3.tgz", "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==" }, - "escape-latex": { + "node_modules/escape-latex": { "version": "1.2.0", "resolved": "https://registry.npmmirror.com/escape-latex/-/escape-latex-1.2.0.tgz", "integrity": "sha512-nV5aVWW1K0wEiUIEdZ4erkGGH8mDxGyxSeqPzRNtWP7ataw+/olFObw7hujFWlVjNsaDFw5VZ5NzVSIqRgfTiw==" }, - "fraction.js": { + "node_modules/fraction.js": { "version": "5.2.1", "resolved": "https://registry.npmmirror.com/fraction.js/-/fraction.js-5.2.1.tgz", - "integrity": "sha512-Ah6t/7YCYjrPUFUFsOsRLMXAdnYM+aQwmojD2Ayb/Ezr82SwES0vuyQ8qZ3QO8n9j7W14VJuVZZet8U3bhSdQQ==" + "integrity": "sha512-Ah6t/7YCYjrPUFUFsOsRLMXAdnYM+aQwmojD2Ayb/Ezr82SwES0vuyQ8qZ3QO8n9j7W14VJuVZZet8U3bhSdQQ==", + "engines": { + "node": ">= 12" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/rawify" + } }, - "javascript-natural-sort": { + "node_modules/javascript-natural-sort": { "version": "0.7.1", "resolved": "https://registry.npmmirror.com/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz", "integrity": "sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw==" }, - "mathjs": { + "node_modules/mathjs": { "version": "14.0.1", "resolved": "https://registry.npmmirror.com/mathjs/-/mathjs-14.0.1.tgz", "integrity": "sha512-yyJgLwC6UXuve724np8tHRMYaTtb5UqiOGQkjwbSXgH8y1C/LcJ0pvdNDZLI2LT7r+iExh2Y5HwfAY+oZFtGIQ==", - "requires": { + "dependencies": { "@babel/runtime": "^7.25.7", "complex.js": "^2.2.5", "decimal.js": "^10.4.3", @@ -49,32 +73,48 @@ "seedrandom": "^3.0.5", "tiny-emitter": "^2.1.0", "typed-function": "^4.2.1" + }, + "bin": { + "mathjs": "bin/cli.js" + }, + "engines": { + "node": ">= 18" } }, +<<<<<<< .mine + "node_modules/mitt": { + "version": "3.0.1", + "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==" + +======= "mitt": { "version": "3.0.1", "resolved": "https://registry.npmmirror.com/mitt/-/mitt-3.0.1.tgz", "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==" +>>>>>>> .theirs }, - "regenerator-runtime": { + "node_modules/regenerator-runtime": { "version": "0.14.1", "resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" }, - "seedrandom": { + "node_modules/seedrandom": { "version": "3.0.5", "resolved": "https://registry.npmmirror.com/seedrandom/-/seedrandom-3.0.5.tgz", "integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==" }, - "tiny-emitter": { + "node_modules/tiny-emitter": { "version": "2.1.0", "resolved": "https://registry.npmmirror.com/tiny-emitter/-/tiny-emitter-2.1.0.tgz", "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==" }, - "typed-function": { + "node_modules/typed-function": { "version": "4.2.1", "resolved": "https://registry.npmmirror.com/typed-function/-/typed-function-4.2.1.tgz", - "integrity": "sha512-EGjWssW7Tsk4DGfE+5yluuljS1OGYWiI1J6e8puZz9nTMM51Oug8CD5Zo4gWMsOhq5BI+1bF+rWTm4Vbj3ivRA==" + "integrity": "sha512-EGjWssW7Tsk4DGfE+5yluuljS1OGYWiI1J6e8puZz9nTMM51Oug8CD5Zo4gWMsOhq5BI+1bF+rWTm4Vbj3ivRA==", + "engines": { + "node": ">= 18" + } } } } diff --git a/unpackage/dist/dev/mp-weixin/addProduct.js b/unpackage/dist/dev/mp-weixin/addProduct.js index 2da82fb..09601cd 100644 --- a/unpackage/dist/dev/mp-weixin/addProduct.js +++ b/unpackage/dist/dev/mp-weixin/addProduct.js @@ -29,11 +29,8 @@ const _sfc_main = { cookie: common_vendor.wx$1.getStorageSync("cookie") }, data: { - userId: userInfo.value.id, goodId: productBrief.value.id, - quantity: quantity.value, - subtotal: productBrief.value.price * quantity.value, - isGoodType: productBrief.value.isGoodType + quantity: quantity.value } }); if (res.data.code === 1) { @@ -46,13 +43,13 @@ const _sfc_main = { console.log("失败原因-->", res.data); common_vendor.index.showToast({ icon: "error", - title: "请求失败" + title: res.data.message }); return; } }; const decrease = () => { - if (quantity.value > 0) { + if (quantity.value != 1) { quantity.value -= 1; } }; @@ -75,5 +72,5 @@ const _sfc_main = { }; } }; -const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-ac6f555c"]]); +const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-ac6f555c"], ["__file", "D:/微信小程序/课设整合/匠承非遗小程序端/jiangchengfeiyi-xiaochengxu/pages/Shopping-cart/component/addProduct.vue"]]); exports.MiniProgramPage = MiniProgramPage; diff --git a/unpackage/dist/dev/mp-weixin/app.js b/unpackage/dist/dev/mp-weixin/app.js index f902777..426325a 100644 --- a/unpackage/dist/dev/mp-weixin/app.js +++ b/unpackage/dist/dev/mp-weixin/app.js @@ -12,17 +12,14 @@ if (!Math) { "./pages/booking/ContactInformation.js"; "./pages/booking/date.js"; "./pages/store-home/ProductDetails/ProductDetails.js"; - "./pages/Shopping-cart/Phone/Phone.js"; - "./pages/order/product-unpay/product-unpay.js"; + "./pages/order/product-paysuccess/product-paysuccess.js"; "./pages/booking/BillingOfFees/BillingOfFees.js"; "./pages/booking/ReservationInstructions/ReservationInstructions.js"; "./pages/booking/respectable/respectable.js"; "./pages/Shopping-cart/newaddress_Info/newaddress_Info.js"; "./pages/order/product-waitpay/product-waitpay.js"; - "./pages/order/paysuccess/paysuccess.js"; "./pages/booking/Simple/Simple.js"; "./pages/booking/bookingpay/bookingpay.js"; - "./pages/order/productOrderDetail/productOrderDetail.js"; "./pages/login/login.js"; "./pages/Shopping-cart/component/addProduct.js"; "./pages/mine/OrderDetails/OrderDetails.js"; @@ -31,12 +28,17 @@ if (!Math) { "./pages/booking/CostumeDisplay/CostumeDisplay.js"; "./pages/booking/CostumeDetails/CostumeDetails.js"; "./pages/mine/Contact/Contact.js"; + "./pages/workshop/productmain/productmain.js"; + "./pages/workshop/component/timePopUp.js"; + "./pages/store-home/main/testMain.js"; + "./pages/syy.js"; + "./pages/order/singleGoodOrder/singleGoodOrder.js"; } const _sfc_main = {}; function _sfc_render(_ctx, _cache) { return {}; } -const App = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]); +const App = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "D:/微信小程序/课设整合/匠承非遗小程序端/jiangchengfeiyi-xiaochengxu/App.vue"]]); function createApp() { const app = common_vendor.createSSRApp(App); app.use(store_index.pinia); diff --git a/unpackage/dist/dev/mp-weixin/app.json b/unpackage/dist/dev/mp-weixin/app.json index 5ef8c6a..80d0549 100644 --- a/unpackage/dist/dev/mp-weixin/app.json +++ b/unpackage/dist/dev/mp-weixin/app.json @@ -9,17 +9,14 @@ "pages/booking/ContactInformation", "pages/booking/date", "pages/store-home/ProductDetails/ProductDetails", - "pages/Shopping-cart/Phone/Phone", - "pages/order/product-unpay/product-unpay", + "pages/order/product-paysuccess/product-paysuccess", "pages/booking/BillingOfFees/BillingOfFees", "pages/booking/ReservationInstructions/ReservationInstructions", "pages/booking/respectable/respectable", "pages/Shopping-cart/newaddress_Info/newaddress_Info", "pages/order/product-waitpay/product-waitpay", - "pages/order/paysuccess/paysuccess", "pages/booking/Simple/Simple", "pages/booking/bookingpay/bookingpay", - "pages/order/productOrderDetail/productOrderDetail", "pages/login/login", "pages/Shopping-cart/component/addProduct", "pages/mine/OrderDetails/OrderDetails", @@ -27,7 +24,12 @@ "pages/workshop/index/index", "pages/booking/CostumeDisplay/CostumeDisplay", "pages/booking/CostumeDetails/CostumeDetails", - "pages/mine/Contact/Contact" + "pages/mine/Contact/Contact", + "pages/workshop/productmain/productmain", + "pages/workshop/component/timePopUp", + "pages/store-home/main/testMain", + "pages/syy", + "pages/order/singleGoodOrder/singleGoodOrder" ], "window": { "navigationBarTextStyle": "black", @@ -36,30 +38,26 @@ "backgroundColor": "#F8F8F8" }, "tabBar": { - "backgroundColor": "#F7E7C6", + "backgroundColor": "#FFFFFF", "list": [ { "pagePath": "pages/home/home", "iconPath": "./static/home.png", - "selectedIconPath": "./static/homeselected.png", "text": "首页" }, { "pagePath": "pages/store-home/main/main", "iconPath": "./static/store.png", - "selectedIconPath": "./static/storeselected.png", "text": "商城" }, { "pagePath": "pages/Shopping-cart/productmain/productmain", "iconPath": "./static/shopcar.png", - "selectedIconPath": "./static/shopcarselected.png", "text": "购物车" }, { "pagePath": "pages/mine/main/main", "iconPath": "./static/mine.png", - "selectedIconPath": "./static/mineselected.png", "text": "我的" } ] diff --git a/unpackage/dist/dev/mp-weixin/assets/add.c73b1e4b.png b/unpackage/dist/dev/mp-weixin/assets/add.c73b1e4b.png deleted file mode 100644 index 7f1530a..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/add.c73b1e4b.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/add.dace8cf5.png b/unpackage/dist/dev/mp-weixin/assets/add.dace8cf5.png deleted file mode 100644 index 0b3310f..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/add.dace8cf5.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/address.e91cc3a1.png b/unpackage/dist/dev/mp-weixin/assets/address.e91cc3a1.png deleted file mode 100644 index adf3f3e..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/address.e91cc3a1.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/avator.7ac17437.png b/unpackage/dist/dev/mp-weixin/assets/avator.7ac17437.png deleted file mode 100644 index 59348f3..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/avator.7ac17437.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/background.27d7292c.png b/unpackage/dist/dev/mp-weixin/assets/background.27d7292c.png deleted file mode 100644 index 8d35895..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/background.27d7292c.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/cailiaobao.52f9097b.png b/unpackage/dist/dev/mp-weixin/assets/cailiaobao.52f9097b.png deleted file mode 100644 index 5e14e41..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/cailiaobao.52f9097b.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/choose.f501b5d4.png b/unpackage/dist/dev/mp-weixin/assets/choose.f501b5d4.png deleted file mode 100644 index 5b700ad..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/choose.f501b5d4.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/choosed.ea32c69c.png b/unpackage/dist/dev/mp-weixin/assets/choosed.ea32c69c.png deleted file mode 100644 index 8d36d1f..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/choosed.ea32c69c.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/daifahuo.8369326b.png b/unpackage/dist/dev/mp-weixin/assets/daifahuo.8369326b.png deleted file mode 100644 index 03f76bc..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/daifahuo.8369326b.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/daishouhuo.ff694766.png b/unpackage/dist/dev/mp-weixin/assets/daishouhuo.ff694766.png deleted file mode 100644 index 9a7a971..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/daishouhuo.ff694766.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/dec.1cf16d78.png b/unpackage/dist/dev/mp-weixin/assets/dec.1cf16d78.png deleted file mode 100644 index c68cb7f..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/dec.1cf16d78.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/denglong.a91d13af.png b/unpackage/dist/dev/mp-weixin/assets/denglong.a91d13af.png deleted file mode 100644 index bcd82ea..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/denglong.a91d13af.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/dingdan.6b4043d6.png b/unpackage/dist/dev/mp-weixin/assets/dingdan.6b4043d6.png deleted file mode 100644 index f247263..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/dingdan.6b4043d6.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/dingwei.69908177.png b/unpackage/dist/dev/mp-weixin/assets/dingwei.69908177.png deleted file mode 100644 index 42904d6..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/dingwei.69908177.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/dingwei.a57a6fb6.png b/unpackage/dist/dev/mp-weixin/assets/dingwei.a57a6fb6.png deleted file mode 100644 index f09812a..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/dingwei.a57a6fb6.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/dingzhi.d6614f9f.png b/unpackage/dist/dev/mp-weixin/assets/dingzhi.d6614f9f.png deleted file mode 100644 index fe9c8c7..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/dingzhi.d6614f9f.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/haibao.2883ea9c.png b/unpackage/dist/dev/mp-weixin/assets/haibao.2883ea9c.png deleted file mode 100644 index 1a9c5df..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/haibao.2883ea9c.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/jifenduihuan.a1c23524.png b/unpackage/dist/dev/mp-weixin/assets/jifenduihuan.a1c23524.png deleted file mode 100644 index 9ae355a..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/jifenduihuan.a1c23524.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/kefu.eef0848c.png b/unpackage/dist/dev/mp-weixin/assets/kefu.eef0848c.png deleted file mode 100644 index 796f5d4..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/kefu.eef0848c.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/left.ddabbcdb.png b/unpackage/dist/dev/mp-weixin/assets/left.ddabbcdb.png deleted file mode 100644 index 8d07527..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/left.ddabbcdb.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/lianxiren_s.17e4954c.png b/unpackage/dist/dev/mp-weixin/assets/lianxiren_s.17e4954c.png deleted file mode 100644 index 80ada84..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/lianxiren_s.17e4954c.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/product.72fb10c1.png b/unpackage/dist/dev/mp-weixin/assets/product.72fb10c1.png deleted file mode 100644 index f7b1566..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/product.72fb10c1.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/product.7900e336.png b/unpackage/dist/dev/mp-weixin/assets/product.7900e336.png deleted file mode 100644 index fa97349..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/product.7900e336.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/product.d45a003d.png b/unpackage/dist/dev/mp-weixin/assets/product.d45a003d.png deleted file mode 100644 index 43f64bf..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/product.d45a003d.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/productimg.a8fe2d32.png b/unpackage/dist/dev/mp-weixin/assets/productimg.a8fe2d32.png deleted file mode 100644 index 1ddfcae..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/productimg.a8fe2d32.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/pull.902be841.png b/unpackage/dist/dev/mp-weixin/assets/pull.902be841.png deleted file mode 100644 index b4410ee..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/pull.902be841.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/qianbao.bbfd6c3d.png b/unpackage/dist/dev/mp-weixin/assets/qianbao.bbfd6c3d.png deleted file mode 100644 index 596ce1b..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/qianbao.bbfd6c3d.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/right.99910151.png b/unpackage/dist/dev/mp-weixin/assets/right.99910151.png deleted file mode 100644 index 9962f71..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/right.99910151.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/rili.7746043b.png b/unpackage/dist/dev/mp-weixin/assets/rili.7746043b.png deleted file mode 100644 index a4e0a85..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/rili.7746043b.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/rmb.6e85dd4a.png b/unpackage/dist/dev/mp-weixin/assets/rmb.6e85dd4a.png deleted file mode 100644 index cc3c40f..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/rmb.6e85dd4a.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/rmb.dd886a2c.png b/unpackage/dist/dev/mp-weixin/assets/rmb.dd886a2c.png deleted file mode 100644 index e397201..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/rmb.dd886a2c.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/rmb_32.6ba70d59.png b/unpackage/dist/dev/mp-weixin/assets/rmb_32.6ba70d59.png deleted file mode 100644 index 015faa7..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/rmb_32.6ba70d59.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/rmb_36px.929d25f5.png b/unpackage/dist/dev/mp-weixin/assets/rmb_36px.929d25f5.png deleted file mode 100644 index 60e9daf..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/rmb_36px.929d25f5.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/rmb_cheng.03ace464.png b/unpackage/dist/dev/mp-weixin/assets/rmb_cheng.03ace464.png deleted file mode 100644 index b176eea..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/rmb_cheng.03ace464.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/rmb_huang.28b44dfc.png b/unpackage/dist/dev/mp-weixin/assets/rmb_huang.28b44dfc.png deleted file mode 100644 index a780003..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/rmb_huang.28b44dfc.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/selected.c24e4f58.png b/unpackage/dist/dev/mp-weixin/assets/selected.c24e4f58.png deleted file mode 100644 index 52a1349..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/selected.c24e4f58.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/setting_s.3e5c5149.png b/unpackage/dist/dev/mp-weixin/assets/setting_s.3e5c5149.png deleted file mode 100644 index a7bbb6a..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/setting_s.3e5c5149.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/shangpingtupian.ec8c0440.png b/unpackage/dist/dev/mp-weixin/assets/shangpingtupian.ec8c0440.png deleted file mode 100644 index 12fbf4b..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/shangpingtupian.ec8c0440.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/shizi.dd0347ec.png b/unpackage/dist/dev/mp-weixin/assets/shizi.dd0347ec.png deleted file mode 100644 index d1a8aa9..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/shizi.dd0347ec.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/short.2191a0bf.png b/unpackage/dist/dev/mp-weixin/assets/short.2191a0bf.png deleted file mode 100644 index 4db3f01..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/short.2191a0bf.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/short.be252386.png b/unpackage/dist/dev/mp-weixin/assets/short.be252386.png deleted file mode 100644 index 51481c5..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/short.be252386.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/shouchiwu.37cdee46.png b/unpackage/dist/dev/mp-weixin/assets/shouchiwu.37cdee46.png deleted file mode 100644 index 76fd73a..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/shouchiwu.37cdee46.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/show1.6119e6ca.png b/unpackage/dist/dev/mp-weixin/assets/show1.6119e6ca.png deleted file mode 100644 index ba0c2c1..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/show1.6119e6ca.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/show2.6ef01c5d.png b/unpackage/dist/dev/mp-weixin/assets/show2.6ef01c5d.png deleted file mode 100644 index 57a61e7..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/show2.6ef01c5d.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/show3.4b906849.png b/unpackage/dist/dev/mp-weixin/assets/show3.4b906849.png deleted file mode 100644 index 7b6de73..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/show3.4b906849.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/show4.00c949b6.png b/unpackage/dist/dev/mp-weixin/assets/show4.00c949b6.png deleted file mode 100644 index b5b420d..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/show4.00c949b6.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/sousuokuang.6160c4c7.png b/unpackage/dist/dev/mp-weixin/assets/sousuokuang.6160c4c7.png deleted file mode 100644 index 6f9b05c..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/sousuokuang.6160c4c7.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/success.3df77989.png b/unpackage/dist/dev/mp-weixin/assets/success.3df77989.png deleted file mode 100644 index f1e56e4..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/success.3df77989.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/tianjia.187834c9.png b/unpackage/dist/dev/mp-weixin/assets/tianjia.187834c9.png deleted file mode 100644 index 531f024..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/tianjia.187834c9.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/toushi.6558cc23.png b/unpackage/dist/dev/mp-weixin/assets/toushi.6558cc23.png deleted file mode 100644 index 902ceec..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/toushi.6558cc23.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/tuikuan.d34aac5f.png b/unpackage/dist/dev/mp-weixin/assets/tuikuan.d34aac5f.png deleted file mode 100644 index caad89e..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/tuikuan.d34aac5f.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/xian.51ee54bc.png b/unpackage/dist/dev/mp-weixin/assets/xian.51ee54bc.png deleted file mode 100644 index cec5b52..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/xian.51ee54bc.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/xian2.316f0e4c.png b/unpackage/dist/dev/mp-weixin/assets/xian2.316f0e4c.png deleted file mode 100644 index 953dc8e..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/xian2.316f0e4c.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/xuanchuan.f0fc207c.png b/unpackage/dist/dev/mp-weixin/assets/xuanchuan.f0fc207c.png deleted file mode 100644 index cb9158d..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/xuanchuan.f0fc207c.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/yiwen.9096364a.png b/unpackage/dist/dev/mp-weixin/assets/yiwen.9096364a.png deleted file mode 100644 index 654306a..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/yiwen.9096364a.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/you.60391a00.png b/unpackage/dist/dev/mp-weixin/assets/you.60391a00.png deleted file mode 100644 index c4581b4..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/you.60391a00.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/you.70a370f0.png b/unpackage/dist/dev/mp-weixin/assets/you.70a370f0.png deleted file mode 100644 index 85634cc..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/you.70a370f0.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/you_cheng.a0b56a7d.png b/unpackage/dist/dev/mp-weixin/assets/you_cheng.a0b56a7d.png deleted file mode 100644 index 96adf0d..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/you_cheng.a0b56a7d.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/assets/you_hei.f7b3f203.png b/unpackage/dist/dev/mp-weixin/assets/you_hei.f7b3f203.png deleted file mode 100644 index 871a146..0000000 Binary files a/unpackage/dist/dev/mp-weixin/assets/you_hei.f7b3f203.png and /dev/null differ diff --git a/unpackage/dist/dev/mp-weixin/common/assets.js b/unpackage/dist/dev/mp-weixin/common/assets.js deleted file mode 100644 index 208c02e..0000000 --- a/unpackage/dist/dev/mp-weixin/common/assets.js +++ /dev/null @@ -1,73 +0,0 @@ -"use strict"; -const product$1 = "/assets/product.7900e336.png"; -const rili = "/assets/rili.7746043b.png"; -const xuanchuan = "/assets/xuanchuan.f0fc207c.png"; -const shizi = "/assets/shizi.dd0347ec.png"; -const you$1 = "/assets/you.60391a00.png"; -const add_img = "/assets/tianjia.187834c9.png"; -const sousuokuang = "/assets/sousuokuang.6160c4c7.png"; -const address = "/assets/address.e91cc3a1.png"; -const avator = "/assets/avator.7ac17437.png"; -const daifahuo = "/assets/daifahuo.8369326b.png"; -const daishouhuo = "/assets/daishouhuo.ff694766.png"; -const dingdan = "/assets/dingdan.6b4043d6.png"; -const lianxiren_s = "/assets/lianxiren_s.17e4954c.png"; -const qianbao = "/assets/qianbao.bbfd6c3d.png"; -const setting_s = "/assets/setting_s.3e5c5149.png"; -const tuikuan = "/assets/tuikuan.d34aac5f.png"; -const you = "/assets/you.70a370f0.png"; -const denglong = "/assets/denglong.a91d13af.png"; -const kefu = "/assets/kefu.eef0848c.png"; -const show1 = "/assets/show1.6119e6ca.png"; -const show2 = "/assets/show2.6ef01c5d.png"; -const show3 = "/assets/show3.4b906849.png"; -const show4 = "/assets/show4.00c949b6.png"; -const dingwei$1 = "/assets/dingwei.69908177.png"; -const add = "/assets/add.dace8cf5.png"; -const dingwei = "/assets/dingwei.a57a6fb6.png"; -const rmb_36px = "/assets/rmb_36px.929d25f5.png"; -const rmb_huang = "/assets/rmb_huang.28b44dfc.png"; -const short = "/assets/short.be252386.png"; -const yiwen = "/assets/yiwen.9096364a.png"; -const you_cheng = "/assets/you_cheng.a0b56a7d.png"; -const success = "/assets/success.3df77989.png"; -const xian = "/assets/xian.51ee54bc.png"; -const xian2 = "/assets/xian2.316f0e4c.png"; -const rmb = "/assets/rmb.dd886a2c.png"; -const product = "/assets/product.d45a003d.png"; -exports.add = add; -exports.add_img = add_img; -exports.address = address; -exports.avator = avator; -exports.daifahuo = daifahuo; -exports.daishouhuo = daishouhuo; -exports.denglong = denglong; -exports.dingdan = dingdan; -exports.dingwei = dingwei$1; -exports.dingwei$1 = dingwei; -exports.kefu = kefu; -exports.lianxiren_s = lianxiren_s; -exports.product = product$1; -exports.product$1 = product; -exports.qianbao = qianbao; -exports.rili = rili; -exports.rmb = rmb; -exports.rmb_36px = rmb_36px; -exports.rmb_huang = rmb_huang; -exports.setting_s = setting_s; -exports.shizi = shizi; -exports.short = short; -exports.show1 = show1; -exports.show2 = show2; -exports.show3 = show3; -exports.show4 = show4; -exports.sousuokuang = sousuokuang; -exports.success = success; -exports.tuikuan = tuikuan; -exports.xian = xian; -exports.xian2 = xian2; -exports.xuanchuan = xuanchuan; -exports.yiwen = yiwen; -exports.you = you$1; -exports.you$1 = you; -exports.you_cheng = you_cheng; diff --git a/unpackage/dist/dev/mp-weixin/common/global.js b/unpackage/dist/dev/mp-weixin/common/global.js new file mode 100644 index 0000000..3d25558 --- /dev/null +++ b/unpackage/dist/dev/mp-weixin/common/global.js @@ -0,0 +1,38 @@ +"use strict"; +const stateList = [ + { + state: "待支付", + img: "https://carbon2.obs.cn-north-4.myhuaweicloud.com:443/feiyi%2Ftest%2F0%2FFybMDtHR-dengdaifukuan.png", + msg: "等待买家付款" + }, + { + state: "待发货", + img: "https://carbon2.obs.cn-north-4.myhuaweicloud.com:443/feiyi%2Ftest%2F0%2FEOzVqolp-fahuo.png", + msg: "等待卖家发货" + }, + { + state: "已退款", + img: "https://carbon2.obs.cn-north-4.myhuaweicloud.com:443/feiyi%2Ftest%2F0%2FlPnvgqCp-yituikuan.png", + msg: "订单已经退款" + }, + { + state: "待收货", + img: "https://carbon2.obs.cn-north-4.myhuaweicloud.com:443/feiyi%2Ftest%2F0%2FEOzVqolp-fahuo.png", + msg: "商品已发货,注意查收" + }, + { + state: "交易成功", + img: "", + msg: "订单完成,感谢您的支持" + }, + { + state: "交易关闭", + img: "https://carbon2.obs.cn-north-4.myhuaweicloud.com:443/feiyi%2Ftest%2F0%2FaHDhacaI-dengdaifukuan.png", + msg: "您的订单已关闭" + } +]; +const stateMap = /* @__PURE__ */ new Map(); +stateList.forEach((item) => { + stateMap.set(item.state, item); +}); +exports.stateMap = stateMap; diff --git a/unpackage/dist/dev/mp-weixin/common/vendor.js b/unpackage/dist/dev/mp-weixin/common/vendor.js index ee3f3eb..1357684 100644 --- a/unpackage/dist/dev/mp-weixin/common/vendor.js +++ b/unpackage/dist/dev/mp-weixin/common/vendor.js @@ -25,22 +25,22 @@ const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && const isModelListener = (key) => key.startsWith("onUpdate:"); const extend = Object.assign; const remove = (arr, el) => { - const i = arr.indexOf(el); - if (i > -1) { - arr.splice(i, 1); + const i2 = arr.indexOf(el); + if (i2 > -1) { + arr.splice(i2, 1); } }; -const hasOwnProperty$1 = Object.prototype.hasOwnProperty; -const hasOwn = (val, key) => hasOwnProperty$1.call(val, key); -const isArray = Array.isArray; -const isMap = (val) => toTypeString(val) === "[object Map]"; +const hasOwnProperty$3 = Object.prototype.hasOwnProperty; +const hasOwn$1 = (val, key) => hasOwnProperty$3.call(val, key); +const isArray$1 = Array.isArray; +const isMap$1 = (val) => toTypeString(val) === "[object Map]"; const isSet = (val) => toTypeString(val) === "[object Set]"; -const isFunction = (val) => typeof val === "function"; -const isString = (val) => typeof val === "string"; +const isFunction$1 = (val) => typeof val === "function"; +const isString$1 = (val) => typeof val === "string"; const isSymbol = (val) => typeof val === "symbol"; -const isObject = (val) => val !== null && typeof val === "object"; +const isObject$2 = (val) => val !== null && typeof val === "object"; const isPromise = (val) => { - return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch); + return (isObject$2(val) || isFunction$1(val)) && isFunction$1(val.then) && isFunction$1(val.catch); }; const objectToString = Object.prototype.toString; const toTypeString = (value) => objectToString.call(value); @@ -48,7 +48,7 @@ const toRawType = (value) => { return toTypeString(value).slice(8, -1); }; const isPlainObject$1 = (val) => toTypeString(val) === "[object Object]"; -const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key; +const isIntegerKey = (key) => isString$1(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key; const isReservedProp = /* @__PURE__ */ makeMap( // the leading comma is intentional so empty string "" is also included ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted" @@ -65,7 +65,7 @@ const cacheStringFunction = (fn) => { }; const camelizeRE = /-(\w)/g; const camelize = cacheStringFunction((str) => { - return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : ""); + return str.replace(camelizeRE, (_2, c2) => c2 ? c2.toUpperCase() : ""); }); const hyphenateRE = /\B([A-Z])/g; const hyphenate = cacheStringFunction( @@ -80,8 +80,8 @@ const toHandlerKey = cacheStringFunction((str) => { }); const hasChanged = (value, oldValue) => !Object.is(value, oldValue); const invokeArrayFns$1 = (fns, arg) => { - for (let i = 0; i < fns.length; i++) { - fns[i](arg); + for (let i2 = 0; i2 < fns.length; i2++) { + fns[i2](arg); } }; const def = (obj, key, value) => { @@ -100,11 +100,11 @@ const getGlobalThis = () => { return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {}); }; function normalizeStyle(value) { - if (isArray(value)) { + if (isArray$1(value)) { const res = {}; - for (let i = 0; i < value.length; i++) { - const item = value[i]; - const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item); + for (let i2 = 0; i2 < value.length; i2++) { + const item = value[i2]; + const normalized = isString$1(item) ? parseStringStyle(item) : normalizeStyle(item); if (normalized) { for (const key in normalized) { res[key] = normalized[key]; @@ -112,7 +112,7 @@ function normalizeStyle(value) { } } return res; - } else if (isString(value) || isObject(value)) { + } else if (isString$1(value) || isObject$2(value)) { return value; } } @@ -131,35 +131,35 @@ function parseStringStyle(cssText) { } function normalizeClass(value) { let res = ""; - if (isString(value)) { + if (isString$1(value)) { res = value; - } else if (isArray(value)) { - for (let i = 0; i < value.length; i++) { - const normalized = normalizeClass(value[i]); + } else if (isArray$1(value)) { + for (let i2 = 0; i2 < value.length; i2++) { + const normalized = normalizeClass(value[i2]); if (normalized) { res += normalized + " "; } } - } else if (isObject(value)) { - for (const name in value) { - if (value[name]) { - res += name + " "; + } else if (isObject$2(value)) { + for (const name2 in value) { + if (value[name2]) { + res += name2 + " "; } } } return res.trim(); } const toDisplayString = (val) => { - return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val); + return isString$1(val) ? val : val == null ? "" : isArray$1(val) || isObject$2(val) && (val.toString === objectToString || !isFunction$1(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val); }; const replacer = (_key, val) => { if (val && val.__v_isRef) { return replacer(_key, val.value); - } else if (isMap(val)) { + } else if (isMap$1(val)) { return { [`Map(${val.size})`]: [...val.entries()].reduce( - (entries, [key, val2], i) => { - entries[stringifySymbol(key, i) + " =>"] = val2; + (entries, [key, val2], i2) => { + entries[stringifySymbol(key, i2) + " =>"] = val2; return entries; }, {} @@ -167,19 +167,20 @@ const replacer = (_key, val) => { }; } else if (isSet(val)) { return { - [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v)) + [`Set(${val.size})`]: [...val.values()].map((v2) => stringifySymbol(v2)) }; } else if (isSymbol(val)) { return stringifySymbol(val); - } else if (isObject(val) && !isArray(val) && !isPlainObject$1(val)) { + } else if (isObject$2(val) && !isArray$1(val) && !isPlainObject$1(val)) { return String(val); } return val; }; -const stringifySymbol = (v, i = "") => { +const stringifySymbol = (v2, i2 = "") => { var _a; - return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v; + return isSymbol(v2) ? `Symbol(${(_a = v2.description) != null ? _a : i2})` : v2; }; +const LINEFEED = "\n"; const SLOT_DEFAULT_NAME = "d"; const ON_SHOW = "onShow"; const ON_HIDE = "onHide"; @@ -220,8 +221,8 @@ function addLeadingSlash(str) { } const invokeArrayFns = (fns, arg) => { let ret; - for (let i = 0; i < fns.length; i++) { - ret = fns[i](arg); + for (let i2 = 0; i2 < fns.length; i2++) { + ret = fns[i2](arg); } return ret; }; @@ -236,7 +237,7 @@ function once(fn, ctx = null) { }; } function getValueByDataPath(obj, path) { - if (!isString(path)) { + if (!isString$1(path)) { return; } path = path.replace(/\[(\d+)\]/g, ".$1"); @@ -294,8 +295,8 @@ const PAGE_HOOKS = [ ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED ]; -function isRootHook(name) { - return PAGE_HOOKS.indexOf(name) > -1; +function isRootHook(name2) { + return PAGE_HOOKS.indexOf(name2) > -1; } const UniLifecycleHooks = [ ON_SHOW, @@ -333,13 +334,13 @@ const MINI_PROGRAM_PAGE_RUNTIME_HOOKS = /* @__PURE__ */ (() => { onShareTimeline: 1 << 2 }; })(); -function isUniLifecycleHook(name, value, checkType = true) { - if (checkType && !isFunction(value)) { +function isUniLifecycleHook(name2, value, checkType = true) { + if (checkType && !isFunction$1(value)) { return false; } - if (UniLifecycleHooks.indexOf(name) > -1) { + if (UniLifecycleHooks.indexOf(name2) > -1) { return true; - } else if (name.indexOf("on") === 0) { + } else if (name2.indexOf("on") === 0) { return true; } return false; @@ -357,63 +358,148 @@ function invokeCreateVueAppHook(app) { createVueAppHooks.forEach((hook) => hook(app)); } const invokeCreateErrorHandler = once((app, createErrorHandler2) => { - if (isFunction(app._component.onError)) { + if (isFunction$1(app._component.onError)) { return createErrorHandler2(app); } }); -const E = function() { +const E$1 = function() { }; -E.prototype = { - on: function(name, callback, ctx) { +E$1.prototype = { + on: function(name2, callback, ctx) { var e2 = this.e || (this.e = {}); - (e2[name] || (e2[name] = [])).push({ + (e2[name2] || (e2[name2] = [])).push({ fn: callback, ctx }); return this; }, - once: function(name, callback, ctx) { + once: function(name2, callback, ctx) { var self2 = this; function listener() { - self2.off(name, listener); + self2.off(name2, listener); callback.apply(ctx, arguments); } listener._ = callback; - return this.on(name, listener, ctx); + return this.on(name2, listener, ctx); }, - emit: function(name) { + emit: function(name2) { var data = [].slice.call(arguments, 1); - var evtArr = ((this.e || (this.e = {}))[name] || []).slice(); - var i = 0; + var evtArr = ((this.e || (this.e = {}))[name2] || []).slice(); + var i2 = 0; var len = evtArr.length; - for (i; i < len; i++) { - evtArr[i].fn.apply(evtArr[i].ctx, data); + for (i2; i2 < len; i2++) { + evtArr[i2].fn.apply(evtArr[i2].ctx, data); } return this; }, - off: function(name, callback) { + off: function(name2, callback) { var e2 = this.e || (this.e = {}); - var evts = e2[name]; + var evts = e2[name2]; var liveEvents = []; if (evts && callback) { - for (var i = evts.length - 1; i >= 0; i--) { - if (evts[i].fn === callback || evts[i].fn._ === callback) { - evts.splice(i, 1); + for (var i2 = evts.length - 1; i2 >= 0; i2--) { + if (evts[i2].fn === callback || evts[i2].fn._ === callback) { + evts.splice(i2, 1); break; } } liveEvents = evts; } - liveEvents.length ? e2[name] = liveEvents : delete e2[name]; + liveEvents.length ? e2[name2] = liveEvents : delete e2[name2]; return this; } }; -var E$1 = E; +var E$1$1 = E$1; +const isObject$1 = (val) => val !== null && typeof val === "object"; +const defaultDelimiters = ["{", "}"]; +class BaseFormatter { + constructor() { + this._caches = /* @__PURE__ */ Object.create(null); + } + interpolate(message, values, delimiters = defaultDelimiters) { + if (!values) { + return [message]; + } + let tokens = this._caches[message]; + if (!tokens) { + tokens = parse$2(message, delimiters); + this._caches[message] = tokens; + } + return compile$1(tokens, values); + } +} +const RE_TOKEN_LIST_VALUE = /^(?:\d)+/; +const RE_TOKEN_NAMED_VALUE = /^(?:\w)+/; +function parse$2(format2, [startDelimiter, endDelimiter]) { + const tokens = []; + let position = 0; + let text = ""; + while (position < format2.length) { + let char = format2[position++]; + if (char === startDelimiter) { + if (text) { + tokens.push({ type: "text", value: text }); + } + text = ""; + let sub2 = ""; + char = format2[position++]; + while (char !== void 0 && char !== endDelimiter) { + sub2 += char; + char = format2[position++]; + } + const isClosed = char === endDelimiter; + const type = RE_TOKEN_LIST_VALUE.test(sub2) ? "list" : isClosed && RE_TOKEN_NAMED_VALUE.test(sub2) ? "named" : "unknown"; + tokens.push({ value: sub2, type }); + } else { + text += char; + } + } + text && tokens.push({ type: "text", value: text }); + return tokens; +} +function compile$1(tokens, values) { + const compiled = []; + let index2 = 0; + const mode = Array.isArray(values) ? "list" : isObject$1(values) ? "named" : "unknown"; + if (mode === "unknown") { + return compiled; + } + while (index2 < tokens.length) { + const token = tokens[index2]; + switch (token.type) { + case "text": + compiled.push(token.value); + break; + case "list": + compiled.push(values[parseInt(token.value, 10)]); + break; + case "named": + if (mode === "named") { + compiled.push(values[token.value]); + } else { + { + console.warn(`Type of token '${token.type}' and format of value '${mode}' don't match!`); + } + } + break; + case "unknown": + { + console.warn(`Detect 'unknown' type of token!`); + } + break; + } + index2++; + } + return compiled; +} const LOCALE_ZH_HANS = "zh-Hans"; const LOCALE_ZH_HANT = "zh-Hant"; const LOCALE_EN = "en"; const LOCALE_FR = "fr"; const LOCALE_ES = "es"; +const hasOwnProperty$2 = Object.prototype.hasOwnProperty; +const hasOwn = (val, key) => hasOwnProperty$2.call(val, key); +const defaultFormatter = new BaseFormatter(); function include(str, parts) { return !!parts.find((part) => str.indexOf(part) !== -1); } @@ -453,63 +539,218 @@ function normalizeLocale(locale, messages) { return lang; } } +class I18n { + constructor({ locale, fallbackLocale, messages, watcher, formater: formater2 }) { + this.locale = LOCALE_EN; + this.fallbackLocale = LOCALE_EN; + this.message = {}; + this.messages = {}; + this.watchers = []; + if (fallbackLocale) { + this.fallbackLocale = fallbackLocale; + } + this.formater = formater2 || defaultFormatter; + this.messages = messages || {}; + this.setLocale(locale || LOCALE_EN); + if (watcher) { + this.watchLocale(watcher); + } + } + setLocale(locale) { + const oldLocale = this.locale; + this.locale = normalizeLocale(locale, this.messages) || this.fallbackLocale; + if (!this.messages[this.locale]) { + this.messages[this.locale] = {}; + } + this.message = this.messages[this.locale]; + if (oldLocale !== this.locale) { + this.watchers.forEach((watcher) => { + watcher(this.locale, oldLocale); + }); + } + } + getLocale() { + return this.locale; + } + watchLocale(fn) { + const index2 = this.watchers.push(fn) - 1; + return () => { + this.watchers.splice(index2, 1); + }; + } + add(locale, message, override = true) { + const curMessages = this.messages[locale]; + if (curMessages) { + if (override) { + Object.assign(curMessages, message); + } else { + Object.keys(message).forEach((key) => { + if (!hasOwn(curMessages, key)) { + curMessages[key] = message[key]; + } + }); + } + } else { + this.messages[locale] = message; + } + } + f(message, values, delimiters) { + return this.formater.interpolate(message, values, delimiters).join(""); + } + t(key, locale, values) { + let message = this.message; + if (typeof locale === "string") { + locale = normalizeLocale(locale, this.messages); + locale && (message = this.messages[locale]); + } else { + values = locale; + } + if (!hasOwn(message, key)) { + console.warn(`Cannot translate the value of keypath ${key}. Use the value of keypath as default.`); + return key; + } + return this.formater.interpolate(message[key], values).join(""); + } +} +function watchAppLocale(appVm, i18n) { + if (appVm.$watchLocale) { + appVm.$watchLocale((newLocale) => { + i18n.setLocale(newLocale); + }); + } else { + appVm.$watch(() => appVm.$locale, (newLocale) => { + i18n.setLocale(newLocale); + }); + } +} +function getDefaultLocale() { + if (typeof index !== "undefined" && index.getLocale) { + return index.getLocale(); + } + if (typeof global !== "undefined" && global.getLocale) { + return global.getLocale(); + } + return LOCALE_EN; +} +function initVueI18n(locale, messages = {}, fallbackLocale, watcher) { + if (typeof locale !== "string") { + [locale, messages] = [ + messages, + locale + ]; + } + if (typeof locale !== "string") { + locale = getDefaultLocale(); + } + if (typeof fallbackLocale !== "string") { + fallbackLocale = typeof __uniConfig !== "undefined" && __uniConfig.fallbackLocale || LOCALE_EN; + } + const i18n = new I18n({ + locale, + fallbackLocale, + messages, + watcher + }); + let t2 = (key, values) => { + if (typeof getApp !== "function") { + t2 = function(key2, values2) { + return i18n.t(key2, values2); + }; + } else { + let isWatchedAppLocale = false; + t2 = function(key2, values2) { + const appVm = getApp().$vm; + if (appVm) { + appVm.$locale; + if (!isWatchedAppLocale) { + isWatchedAppLocale = true; + watchAppLocale(appVm, i18n); + } + } + return i18n.t(key2, values2); + }; + } + return t2(key, values); + }; + return { + i18n, + f(message, values, delimiters) { + return i18n.f(message, values, delimiters); + }, + t(key, values) { + return t2(key, values); + }, + add(locale2, message, override = true) { + return i18n.add(locale2, message, override); + }, + watch(fn) { + return i18n.watchLocale(fn); + }, + getLocale() { + return i18n.getLocale(); + }, + setLocale(newLocale) { + return i18n.setLocale(newLocale); + } + }; +} function getBaseSystemInfo() { return wx.getSystemInfoSync(); } -function validateProtocolFail(name, msg) { - console.warn(`${name}: ${msg}`); +function validateProtocolFail(name2, msg) { + console.warn(`${name2}: ${msg}`); } -function validateProtocol(name, data, protocol, onFail) { +function validateProtocol(name2, data, protocol, onFail) { if (!onFail) { onFail = validateProtocolFail; } for (const key in protocol) { - const errMsg = validateProp$1(key, data[key], protocol[key], !hasOwn(data, key)); - if (isString(errMsg)) { - onFail(name, errMsg); + const errMsg = validateProp$1(key, data[key], protocol[key], !hasOwn$1(data, key)); + if (isString$1(errMsg)) { + onFail(name2, errMsg); } } } -function validateProtocols(name, args, protocol, onFail) { +function validateProtocols(name2, args, protocol, onFail) { if (!protocol) { return; } - if (!isArray(protocol)) { - return validateProtocol(name, args[0] || /* @__PURE__ */ Object.create(null), protocol, onFail); + if (!isArray$1(protocol)) { + return validateProtocol(name2, args[0] || /* @__PURE__ */ Object.create(null), protocol, onFail); } const len = protocol.length; const argsLen = args.length; - for (let i = 0; i < len; i++) { - const opts = protocol[i]; + for (let i2 = 0; i2 < len; i2++) { + const opts = protocol[i2]; const data = /* @__PURE__ */ Object.create(null); - if (argsLen > i) { - data[opts.name] = args[i]; + if (argsLen > i2) { + data[opts.name] = args[i2]; } - validateProtocol(name, data, { [opts.name]: opts }, onFail); + validateProtocol(name2, data, { [opts.name]: opts }, onFail); } } -function validateProp$1(name, value, prop, isAbsent) { +function validateProp$1(name2, value, prop, isAbsent) { if (!isPlainObject$1(prop)) { prop = { type: prop }; } const { type, required, validator } = prop; if (required && isAbsent) { - return 'Missing required args: "' + name + '"'; + return 'Missing required args: "' + name2 + '"'; } if (value == null && !required) { return; } if (type != null) { let isValid = false; - const types = isArray(type) ? type : [type]; + const types = isArray$1(type) ? type : [type]; const expectedTypes = []; - for (let i = 0; i < types.length && !isValid; i++) { - const { valid, expectedType } = assertType$1(value, types[i]); + for (let i2 = 0; i2 < types.length && !isValid; i2++) { + const { valid, expectedType } = assertType$1(value, types[i2]); expectedTypes.push(expectedType || ""); isValid = valid; } if (!isValid) { - return getInvalidTypeMessage$1(name, value, expectedTypes); + return getInvalidTypeMessage$1(name2, value, expectedTypes); } } if (validator) { @@ -527,9 +768,9 @@ function assertType$1(value, type) { valid = value instanceof type; } } else if (expectedType === "Object") { - valid = isObject(value); + valid = isObject$2(value); } else if (expectedType === "Array") { - valid = isArray(value); + valid = isArray$1(value); } else { { valid = value instanceof type; @@ -540,13 +781,13 @@ function assertType$1(value, type) { expectedType }; } -function getInvalidTypeMessage$1(name, value, expectedTypes) { - let message = `Invalid args: type check failed for args "${name}". Expected ${expectedTypes.map(capitalize).join(", ")}`; +function getInvalidTypeMessage$1(name2, value, expectedTypes) { + let message = `Invalid args: type check failed for args "${name2}". Expected ${expectedTypes.map(capitalize).join(", ")}`; const expectedType = expectedTypes[0]; const receivedType = toRawType(value); const expectedValue = styleValue$1(value, expectedType); const receivedValue = styleValue$1(value, receivedType); - if (expectedTypes.length === 1 && isExplicable$1(expectedType) && !isBoolean$1(expectedType, receivedType)) { + if (expectedTypes.length === 1 && isExplicable$1(expectedType) && !isBoolean$2(expectedType, receivedType)) { message += ` with value ${expectedValue}`; } message += `, got ${receivedType} `; @@ -572,7 +813,7 @@ function isExplicable$1(type) { const explicitTypes = ["string", "number", "boolean"]; return explicitTypes.some((elem) => type.toLowerCase() === elem); } -function isBoolean$1(...args) { +function isBoolean$2(...args) { return args.some((elem) => elem.toLowerCase() === "boolean"); } function tryCatch(fn) { @@ -586,9 +827,9 @@ function tryCatch(fn) { } let invokeCallbackId = 1; const invokeCallbacks = {}; -function addInvokeCallback(id, name, callback, keepAlive = false) { +function addInvokeCallback(id, name2, callback, keepAlive = false) { invokeCallbacks[id] = { - name, + name: name2, keepAlive, callback }; @@ -611,36 +852,36 @@ const API_FAIL = "fail"; const API_COMPLETE = "complete"; function getApiCallbacks(args) { const apiCallbacks = {}; - for (const name in args) { - const fn = args[name]; - if (isFunction(fn)) { - apiCallbacks[name] = tryCatch(fn); - delete args[name]; + for (const name2 in args) { + const fn = args[name2]; + if (isFunction$1(fn)) { + apiCallbacks[name2] = tryCatch(fn); + delete args[name2]; } } return apiCallbacks; } -function normalizeErrMsg(errMsg, name) { +function normalizeErrMsg$1(errMsg, name2) { if (!errMsg || errMsg.indexOf(":fail") === -1) { - return name + ":ok"; + return name2 + ":ok"; } - return name + errMsg.substring(errMsg.indexOf(":fail")); + return name2 + errMsg.substring(errMsg.indexOf(":fail")); } -function createAsyncApiCallback(name, args = {}, { beforeAll, beforeSuccess } = {}) { +function createAsyncApiCallback(name2, args = {}, { beforeAll, beforeSuccess } = {}) { if (!isPlainObject$1(args)) { args = {}; } const { success, fail, complete } = getApiCallbacks(args); - const hasSuccess = isFunction(success); - const hasFail = isFunction(fail); - const hasComplete = isFunction(complete); + const hasSuccess = isFunction$1(success); + const hasFail = isFunction$1(fail); + const hasComplete = isFunction$1(complete); const callbackId = invokeCallbackId++; - addInvokeCallback(callbackId, name, (res) => { + addInvokeCallback(callbackId, name2, (res) => { res = res || {}; - res.errMsg = normalizeErrMsg(res.errMsg, name); - isFunction(beforeAll) && beforeAll(res); - if (res.errMsg === name + ":ok") { - isFunction(beforeSuccess) && beforeSuccess(res, args); + res.errMsg = normalizeErrMsg$1(res.errMsg, name2); + isFunction$1(beforeAll) && beforeAll(res); + if (res.errMsg === name2 + ":ok") { + isFunction$1(beforeSuccess) && beforeSuccess(res, args); hasSuccess && success(res); } else { hasFail && fail(res); @@ -661,8 +902,8 @@ function wrapperHook(hook, params) { } function queue$2(hooks, data, params) { let promise = false; - for (let i = 0; i < hooks.length; i++) { - const hook = hooks[i]; + for (let i2 = 0; i2 < hooks.length; i2++) { + const hook = hooks[i2]; if (promise) { promise = Promise.resolve(wrapperHook(hook, params)); } else { @@ -689,15 +930,15 @@ function queue$2(hooks, data, params) { }; } function wrapperOptions(interceptors2, options = {}) { - [HOOK_SUCCESS, HOOK_FAIL, HOOK_COMPLETE].forEach((name) => { - const hooks = interceptors2[name]; - if (!isArray(hooks)) { + [HOOK_SUCCESS, HOOK_FAIL, HOOK_COMPLETE].forEach((name2) => { + const hooks = interceptors2[name2]; + if (!isArray$1(hooks)) { return; } - const oldCallback = options[name]; - options[name] = function callbackInterceptor(res) { + const oldCallback = options[name2]; + options[name2] = function callbackInterceptor(res) { queue$2(hooks, res, options).then((res2) => { - return isFunction(oldCallback) && oldCallback(res2) || res2; + return isFunction$1(oldCallback) && oldCallback(res2) || res2; }); }; }); @@ -705,11 +946,11 @@ function wrapperOptions(interceptors2, options = {}) { } function wrapperReturnValue(method, returnValue) { const returnValueHooks = []; - if (isArray(globalInterceptors.returnValue)) { + if (isArray$1(globalInterceptors.returnValue)) { returnValueHooks.push(...globalInterceptors.returnValue); } const interceptor = scopedInterceptors[method]; - if (interceptor && isArray(interceptor.returnValue)) { + if (interceptor && isArray$1(interceptor.returnValue)) { returnValueHooks.push(...interceptor.returnValue); } returnValueHooks.forEach((hook) => { @@ -737,7 +978,7 @@ function getApiInterceptorHooks(method) { function invokeApi(method, api, options, params) { const interceptor = getApiInterceptorHooks(method); if (interceptor && Object.keys(interceptor).length) { - if (isArray(interceptor.invoke)) { + if (isArray$1(interceptor.invoke)) { const res = queue$2(interceptor.invoke, options); return res.then((options2) => { return api(wrapperOptions(getApiInterceptorHooks(method), options2), ...params); @@ -749,7 +990,7 @@ function invokeApi(method, api, options, params) { return api(options, ...params); } function hasCallback(args) { - if (isPlainObject$1(args) && [API_SUCCESS, API_FAIL, API_COMPLETE].find((cb) => isFunction(args[cb]))) { + if (isPlainObject$1(args) && [API_SUCCESS, API_FAIL, API_COMPLETE].find((cb) => isFunction$1(args[cb]))) { return true; } return false; @@ -757,57 +998,57 @@ function hasCallback(args) { function handlePromise(promise) { return promise; } -function promisify$1(name, fn) { +function promisify$1(name2, fn) { return (args = {}, ...rest) => { if (hasCallback(args)) { - return wrapperReturnValue(name, invokeApi(name, fn, args, rest)); + return wrapperReturnValue(name2, invokeApi(name2, fn, args, rest)); } - return wrapperReturnValue(name, handlePromise(new Promise((resolve2, reject) => { - invokeApi(name, fn, extend(args, { success: resolve2, fail: reject }), rest); + return wrapperReturnValue(name2, handlePromise(new Promise((resolve2, reject) => { + invokeApi(name2, fn, extend(args, { success: resolve2, fail: reject }), rest); }))); }; } function formatApiArgs(args, options) { const params = args[0]; - if (!options || !options.formatArgs || !isPlainObject$1(options.formatArgs) && isPlainObject$1(params)) { + if (!options || !isPlainObject$1(options.formatArgs) && isPlainObject$1(params)) { return; } const formatArgs = options.formatArgs; const keys = Object.keys(formatArgs); - for (let i = 0; i < keys.length; i++) { - const name = keys[i]; - const formatterOrDefaultValue = formatArgs[name]; - if (isFunction(formatterOrDefaultValue)) { - const errMsg = formatterOrDefaultValue(args[0][name], params); - if (isString(errMsg)) { + for (let i2 = 0; i2 < keys.length; i2++) { + const name2 = keys[i2]; + const formatterOrDefaultValue = formatArgs[name2]; + if (isFunction$1(formatterOrDefaultValue)) { + const errMsg = formatterOrDefaultValue(args[0][name2], params); + if (isString$1(errMsg)) { return errMsg; } } else { - if (!hasOwn(params, name)) { - params[name] = formatterOrDefaultValue; + if (!hasOwn$1(params, name2)) { + params[name2] = formatterOrDefaultValue; } } } } -function invokeSuccess(id, name, res) { +function invokeSuccess(id, name2, res) { const result = { - errMsg: name + ":ok" + errMsg: name2 + ":ok" }; return invokeCallback(id, extend(res || {}, result)); } -function invokeFail(id, name, errMsg, errRes = {}) { - const apiErrMsg = name + ":fail" + (errMsg ? " " + errMsg : ""); +function invokeFail(id, name2, errMsg, errRes = {}) { + const apiErrMsg = name2 + ":fail" + (errMsg ? " " + errMsg : ""); delete errRes.errCode; let res = extend({ errMsg: apiErrMsg }, errRes); return invokeCallback(id, res); } -function beforeInvokeApi(name, args, protocol, options) { +function beforeInvokeApi(name2, args, protocol, options) { { - validateProtocols(name, args, protocol); + validateProtocols(name2, args, protocol); } if (options && options.beforeInvoke) { const errMsg2 = options.beforeInvoke(args); - if (isString(errMsg2)) { + if (isString$1(errMsg2)) { return errMsg2; } } @@ -816,46 +1057,46 @@ function beforeInvokeApi(name, args, protocol, options) { return errMsg; } } -function parseErrMsg(errMsg) { - if (!errMsg || isString(errMsg)) { +function normalizeErrMsg(errMsg) { + if (!errMsg || isString$1(errMsg)) { return errMsg; } if (errMsg.stack) { - console.error(errMsg.message + "\n" + errMsg.stack); + console.error(errMsg.message + LINEFEED + errMsg.stack); return errMsg.message; } return errMsg; } -function wrapperTaskApi(name, fn, protocol, options) { +function wrapperTaskApi(name2, fn, protocol, options) { return (args) => { - const id = createAsyncApiCallback(name, args, options); - const errMsg = beforeInvokeApi(name, [args], protocol, options); + const id = createAsyncApiCallback(name2, args, options); + const errMsg = beforeInvokeApi(name2, [args], protocol, options); if (errMsg) { - return invokeFail(id, name, errMsg); + return invokeFail(id, name2, errMsg); } return fn(args, { - resolve: (res) => invokeSuccess(id, name, res), - reject: (errMsg2, errRes) => invokeFail(id, name, parseErrMsg(errMsg2), errRes) + resolve: (res) => invokeSuccess(id, name2, res), + reject: (errMsg2, errRes) => invokeFail(id, name2, normalizeErrMsg(errMsg2), errRes) }); }; } -function wrapperSyncApi(name, fn, protocol, options) { +function wrapperSyncApi(name2, fn, protocol, options) { return (...args) => { - const errMsg = beforeInvokeApi(name, args, protocol, options); + const errMsg = beforeInvokeApi(name2, args, protocol, options); if (errMsg) { throw new Error(errMsg); } return fn.apply(null, args); }; } -function wrapperAsyncApi(name, fn, protocol, options) { - return wrapperTaskApi(name, fn, protocol, options); +function wrapperAsyncApi(name2, fn, protocol, options) { + return wrapperTaskApi(name2, fn, protocol, options); } -function defineSyncApi(name, fn, protocol, options) { - return wrapperSyncApi(name, fn, protocol, options); +function defineSyncApi(name2, fn, protocol, options) { + return wrapperSyncApi(name2, fn, protocol, options); } -function defineAsyncApi(name, fn, protocol, options) { - return promisify$1(name, wrapperAsyncApi(name, fn, protocol, options)); +function defineAsyncApi(name2, fn, protocol, options) { + return promisify$1(name2, wrapperAsyncApi(name2, fn, protocol, options)); } const API_UPX2PX = "upx2px"; const Upx2pxProtocol = [ @@ -911,7 +1152,7 @@ const AddInterceptorProtocol = [ const RemoveInterceptorProtocol = AddInterceptorProtocol; function mergeInterceptorHook(interceptors2, interceptor) { Object.keys(interceptor).forEach((hook) => { - if (isFunction(interceptor[hook])) { + if (isFunction$1(interceptor[hook])) { interceptors2[hook] = mergeHook(interceptors2[hook], interceptor[hook]); } }); @@ -920,36 +1161,36 @@ function removeInterceptorHook(interceptors2, interceptor) { if (!interceptors2 || !interceptor) { return; } - Object.keys(interceptor).forEach((name) => { - const hooks = interceptors2[name]; - const hook = interceptor[name]; - if (isArray(hooks) && isFunction(hook)) { + Object.keys(interceptor).forEach((name2) => { + const hooks = interceptors2[name2]; + const hook = interceptor[name2]; + if (isArray$1(hooks) && isFunction$1(hook)) { remove(hooks, hook); } }); } function mergeHook(parentVal, childVal) { - const res = childVal ? parentVal ? parentVal.concat(childVal) : isArray(childVal) ? childVal : [childVal] : parentVal; + const res = childVal ? parentVal ? parentVal.concat(childVal) : isArray$1(childVal) ? childVal : [childVal] : parentVal; return res ? dedupeHooks(res) : res; } function dedupeHooks(hooks) { const res = []; - for (let i = 0; i < hooks.length; i++) { - if (res.indexOf(hooks[i]) === -1) { - res.push(hooks[i]); + for (let i2 = 0; i2 < hooks.length; i2++) { + if (res.indexOf(hooks[i2]) === -1) { + res.push(hooks[i2]); } } return res; } const addInterceptor = defineSyncApi(API_ADD_INTERCEPTOR, (method, interceptor) => { - if (isString(method) && isPlainObject$1(interceptor)) { + if (isString$1(method) && isPlainObject$1(interceptor)) { mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), interceptor); } else if (isPlainObject$1(method)) { mergeInterceptorHook(globalInterceptors, method); } }, AddInterceptorProtocol); const removeInterceptor = defineSyncApi(API_REMOVE_INTERCEPTOR, (method, interceptor) => { - if (isString(method)) { + if (isString$1(method)) { if (isPlainObject$1(interceptor)) { removeInterceptorHook(scopedInterceptors[method], interceptor); } else { @@ -994,26 +1235,26 @@ const EmitProtocol = [ required: true } ]; -const emitter = new E$1(); -const $on = defineSyncApi(API_ON, (name, callback) => { - emitter.on(name, callback); - return () => emitter.off(name, callback); +const emitter = new E$1$1(); +const $on = defineSyncApi(API_ON, (name2, callback) => { + emitter.on(name2, callback); + return () => emitter.off(name2, callback); }, OnProtocol); -const $once = defineSyncApi(API_ONCE, (name, callback) => { - emitter.once(name, callback); - return () => emitter.off(name, callback); +const $once = defineSyncApi(API_ONCE, (name2, callback) => { + emitter.once(name2, callback); + return () => emitter.off(name2, callback); }, OnceProtocol); -const $off = defineSyncApi(API_OFF, (name, callback) => { - if (!name) { +const $off = defineSyncApi(API_OFF, (name2, callback) => { + if (!name2) { emitter.e = {}; return; } - if (!isArray(name)) - name = [name]; - name.forEach((n2) => emitter.off(n2, callback)); + if (!isArray$1(name2)) + name2 = [name2]; + name2.forEach((n2) => emitter.off(n2, callback)); }, OffProtocol); -const $emit = defineSyncApi(API_EMIT, (name, ...args) => { - emitter.emit(name, ...args); +const $emit = defineSyncApi(API_EMIT, (name2, ...args) => { + emitter.emit(name2, ...args); }, EmitProtocol); let cid; let cidErrMsg; @@ -1037,8 +1278,8 @@ function invokePushCallback(args) { type: "receive", data: normalizePushMessage(args.message) }; - for (let i = 0; i < onPushMessageCallbacks.length; i++) { - const callback = onPushMessageCallbacks[i]; + for (let i2 = 0; i2 < onPushMessageCallbacks.length; i2++) { + const callback = onPushMessageCallbacks[i2]; callback(message); if (message.stopped) { break; @@ -1061,7 +1302,7 @@ function invokeGetPushCidCallbacks(cid2, errMsg) { getPushCidCallbacks.length = 0; } const API_GET_PUSH_CLIENT_ID = "getPushClientId"; -const getPushClientId = defineAsyncApi(API_GET_PUSH_CLIENT_ID, (_, { resolve: resolve2, reject }) => { +const getPushClientId = defineAsyncApi(API_GET_PUSH_CLIENT_ID, (_2, { resolve: resolve2, reject }) => { Promise.resolve().then(() => { if (typeof enabled === "undefined") { enabled = false; @@ -1101,17 +1342,17 @@ const CONTEXT_API_RE = /^create|Manager$/; const CONTEXT_API_RE_EXC = ["createBLEConnection"]; const ASYNC_API = ["createBLEConnection"]; const CALLBACK_API_RE = /^on|^off/; -function isContextApi(name) { - return CONTEXT_API_RE.test(name) && CONTEXT_API_RE_EXC.indexOf(name) === -1; +function isContextApi(name2) { + return CONTEXT_API_RE.test(name2) && CONTEXT_API_RE_EXC.indexOf(name2) === -1; } -function isSyncApi(name) { - return SYNC_API_RE.test(name) && ASYNC_API.indexOf(name) === -1; +function isSyncApi(name2) { + return SYNC_API_RE.test(name2) && ASYNC_API.indexOf(name2) === -1; } -function isCallbackApi(name) { - return CALLBACK_API_RE.test(name) && name !== "onPush"; +function isCallbackApi(name2) { + return CALLBACK_API_RE.test(name2) && name2 !== "onPush"; } -function shouldPromise(name) { - if (isContextApi(name) || isSyncApi(name) || isCallbackApi(name)) { +function shouldPromise(name2) { + if (isContextApi(name2) || isSyncApi(name2) || isCallbackApi(name2)) { return false; } return true; @@ -1124,19 +1365,19 @@ if (!Promise.prototype.finally) { })); }; } -function promisify(name, api) { - if (!shouldPromise(name)) { +function promisify(name2, api) { + if (!shouldPromise(name2)) { return api; } - if (!isFunction(api)) { + if (!isFunction$1(api)) { return api; } return function promiseApi(options = {}, ...rest) { - if (isFunction(options.success) || isFunction(options.fail) || isFunction(options.complete)) { - return wrapperReturnValue(name, invokeApi(name, api, options, rest)); + if (isFunction$1(options.success) || isFunction$1(options.fail) || isFunction$1(options.complete)) { + return wrapperReturnValue(name2, invokeApi(name2, api, options, rest)); } - return wrapperReturnValue(name, handlePromise(new Promise((resolve2, reject) => { - invokeApi(name, api, extend({}, options, { + return wrapperReturnValue(name2, handlePromise(new Promise((resolve2, reject) => { + invokeApi(name2, api, extend({}, options, { success: resolve2, fail: reject }), rest); @@ -1153,47 +1394,47 @@ function initWrapper(protocols2) { function processArgs(methodName, fromArgs, argsOption = {}, returnValue = {}, keepFromArgs = false) { if (isPlainObject$1(fromArgs)) { const toArgs = keepFromArgs === true ? fromArgs : {}; - if (isFunction(argsOption)) { + if (isFunction$1(argsOption)) { argsOption = argsOption(fromArgs, toArgs) || {}; } for (const key in fromArgs) { - if (hasOwn(argsOption, key)) { + if (hasOwn$1(argsOption, key)) { let keyOption = argsOption[key]; - if (isFunction(keyOption)) { + if (isFunction$1(keyOption)) { keyOption = keyOption(fromArgs[key], fromArgs, toArgs); } if (!keyOption) { console.warn(`微信小程序 ${methodName} 暂不支持 ${key}`); - } else if (isString(keyOption)) { + } else if (isString$1(keyOption)) { toArgs[keyOption] = fromArgs[key]; } else if (isPlainObject$1(keyOption)) { toArgs[keyOption.name ? keyOption.name : key] = keyOption.value; } } else if (CALLBACKS.indexOf(key) !== -1) { const callback = fromArgs[key]; - if (isFunction(callback)) { + if (isFunction$1(callback)) { toArgs[key] = processCallback(methodName, callback, returnValue); } } else { - if (!keepFromArgs && !hasOwn(toArgs, key)) { + if (!keepFromArgs && !hasOwn$1(toArgs, key)) { toArgs[key] = fromArgs[key]; } } } return toArgs; - } else if (isFunction(fromArgs)) { + } else if (isFunction$1(fromArgs)) { fromArgs = processCallback(methodName, fromArgs, returnValue); } return fromArgs; } function processReturnValue(methodName, res, returnValue, keepReturnValue = false) { - if (isFunction(protocols2.returnValue)) { + if (isFunction$1(protocols2.returnValue)) { res = protocols2.returnValue(methodName, res); } return processArgs(methodName, res, returnValue, {}, keepReturnValue); } return function wrapper(methodName, method) { - if (!hasOwn(protocols2, methodName)) { + if (!hasOwn$1(protocols2, methodName)) { return method; } const protocol = protocols2[methodName]; @@ -1204,7 +1445,7 @@ function initWrapper(protocols2) { } return function(arg1, arg2) { let options = protocol; - if (isFunction(protocol)) { + if (isFunction$1(protocol)) { options = protocol(arg1); } arg1 = processArgs(methodName, arg1, options.args, options.returnValue); @@ -1221,14 +1462,14 @@ function initWrapper(protocols2) { }; } const getLocale = () => { - const app = isFunction(getApp) && getApp({ allowDefault: true }); + const app = isFunction$1(getApp) && getApp({ allowDefault: true }); if (app && app.$vm) { return app.$vm.$locale; } return normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN; }; const setLocale = (locale) => { - const app = isFunction(getApp) && getApp(); + const app = isFunction$1(getApp) && getApp(); if (!app) { return false; } @@ -1252,7 +1493,7 @@ if (typeof global !== "undefined") { const UUID_KEY = "__DC_STAT_UUID"; let deviceId; function useDeviceId(global2 = wx) { - return function addDeviceId(_, toRes) { + return function addDeviceId(_2, toRes) { deviceId = deviceId || global2.getStorageSync(UUID_KEY); if (!deviceId) { deviceId = Date.now() + "" + Math.floor(Math.random() * 1e7); @@ -1297,8 +1538,8 @@ function populateParameters(fromRes, toRes) { appVersion: "1.0.0", appVersionCode: "100", appLanguage: getAppLanguage(hostLanguage), - uniCompileVersion: "4.23", - uniRuntimeVersion: "4.23", + uniCompileVersion: "4.15", + uniRuntimeVersion: "4.15", uniPlatform: "mp-weixin", deviceBrand, deviceModel: model, @@ -1383,7 +1624,7 @@ const previewImage = { return; } const urls = fromArgs.urls; - if (!isArray(urls)) { + if (!isArray$1(urls)) { return; } const len = urls.length; @@ -1487,13 +1728,13 @@ function initUni(api, protocols2, platform = wx) { const wrapper = initWrapper(protocols2); const UniProxyHandlers = { get(target, key) { - if (hasOwn(target, key)) { + if (hasOwn$1(target, key)) { return target[key]; } - if (hasOwn(api, key)) { + if (hasOwn$1(api, key)) { return promisify(key, api[key]); } - if (hasOwn(baseApis, key)) { + if (hasOwn$1(baseApis, key)) { return promisify(key, baseApis[key]); } return promisify(key, wrapper(key, platform[key])); @@ -1510,14 +1751,14 @@ function initGetProvider(providers) { service, provider: providers[service] }; - isFunction(success) && success(res); + isFunction$1(success) && success(res); } else { res = { errMsg: "getProvider:fail:服务[" + service + "]不存在" }; - isFunction(fail) && fail(res); + isFunction$1(fail) && fail(res); } - isFunction(complete) && complete(res); + isFunction$1(complete) && complete(res); }; } const objectKeys = [ @@ -1561,8 +1802,8 @@ const getProvider = initGetProvider({ }); function initComponentMocks(component) { const res = /* @__PURE__ */ Object.create(null); - mocks$1.forEach((name) => { - res[name] = component[name]; + mocks$1.forEach((name2) => { + res[name2] = component[name2]; }); return res; } @@ -1644,9 +1885,9 @@ function warn$1$1(msg, ...args) { instance, 11, [ - msg + args.map((a) => { + msg + args.map((a2) => { var _a, _b; - return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a); + return (_b = (_a = a2.toString) == null ? void 0 : _a.call(a2)) != null ? _b : JSON.stringify(a2); }).join(""), instance && instance.proxy, trace.map( @@ -1688,8 +1929,8 @@ function getComponentTrace$1() { } function formatTrace$1(trace) { const logs = []; - trace.forEach((entry, i) => { - logs.push(...i === 0 ? [] : [` + trace.forEach((entry, i2) => { + logs.push(...i2 === 0 ? [] : [` `], ...formatTraceEntry$1(entry)); }); return logs; @@ -1717,7 +1958,7 @@ function formatProps$1(props) { return res; } function formatProp$1(key, value, raw) { - if (isString(value)) { + if (isString$1(value)) { value = JSON.stringify(value); return raw ? value : [`${key}=${value}`]; } else if (typeof value === "number" || typeof value === "boolean" || value == null) { @@ -1725,7 +1966,7 @@ function formatProp$1(key, value, raw) { } else if (isRef$1(value)) { value = formatProp$1(key, toRaw$1(value.value), true); return raw ? value : [`${key}=Ref<`, value, `>`]; - } else if (isFunction(value)) { + } else if (isFunction$1(value)) { return [`${key}=fn${value.name ? `<${value.name}>` : ``}`]; } else { value = toRaw$1(value); @@ -1779,8 +2020,8 @@ function handleError$1(err, instance, type, throwInDev = true) { while (cur) { const errorCapturedHooks = cur.ec; if (errorCapturedHooks) { - for (let i = 0; i < errorCapturedHooks.length; i++) { - if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) { + for (let i2 = 0; i2 < errorCapturedHooks.length; i2++) { + if (errorCapturedHooks[i2](err, exposedInstance, errorInfo) === false) { return; } } @@ -1861,7 +2102,7 @@ function queueFlush$1() { } } function queuePostFlushCb$1(cb) { - if (!isArray(cb)) { + if (!isArray$1(cb)) { if (!activePostFlushCbs$1 || !activePostFlushCbs$1.includes( cb, cb.allowRecurse ? postFlushIndex$1 + 1 : postFlushIndex$1 @@ -1876,7 +2117,7 @@ function queuePostFlushCb$1(cb) { function flushPostFlushCbs$1(seen) { if (pendingPostFlushCbs$1.length) { const deduped = [...new Set(pendingPostFlushCbs$1)].sort( - (a, b) => getId$1(a) - getId$1(b) + (a2, b2) => getId$1(a2) - getId$1(b2) ); pendingPostFlushCbs$1.length = 0; if (activePostFlushCbs$1) { @@ -1898,12 +2139,12 @@ function flushPostFlushCbs$1(seen) { } } const getId$1 = (job) => job.id == null ? Infinity : job.id; -const comparator$1 = (a, b) => { - const diff2 = getId$1(a) - getId$1(b); +const comparator$1 = (a2, b2) => { + const diff2 = getId$1(a2) - getId$1(b2); if (diff2 === 0) { - if (a.pre && !b.pre) + if (a2.pre && !b2.pre) return -1; - if (b.pre && !a.pre) + if (b2.pre && !a2.pre) return 1; } return diff2; @@ -2057,42 +2298,42 @@ function tryWrap(fn) { }; } { - const g = getGlobalThis(); + const g2 = getGlobalThis(); const registerGlobalSetter = (key, setter) => { let setters; - if (!(setters = g[key])) - setters = g[key] = []; + if (!(setters = g2[key])) + setters = g2[key] = []; setters.push(setter); - return (v) => { + return (v2) => { if (setters.length > 1) - setters.forEach((set2) => set2(v)); + setters.forEach((set2) => set2(v2)); else - setters[0](v); + setters[0](v2); }; }; registerGlobalSetter( `__VUE_INSTANCE_SETTERS__`, - (v) => v + (v2) => v2 ); registerGlobalSetter( `__VUE_SSR_SETTERS__`, - (v) => v + (v2) => v2 ); } const classifyRE$1 = /(?:^|[-_])(\w)/g; const classify$1 = (str) => str.replace(classifyRE$1, (c2) => c2.toUpperCase()).replace(/[-_]/g, ""); function getComponentName$1(Component2, includeInferred = true) { - return isFunction(Component2) ? Component2.displayName || Component2.name : Component2.name || includeInferred && Component2.__name; + return isFunction$1(Component2) ? Component2.displayName || Component2.name : Component2.name || includeInferred && Component2.__name; } function formatComponentName$1(instance, Component2, isRoot = false) { - let name = getComponentName$1(Component2); - if (!name && Component2.__file) { + let name2 = getComponentName$1(Component2); + if (!name2 && Component2.__file) { const match = Component2.__file.match(/([^/\\]+)\.\w+$/); if (match) { - name = match[1]; + name2 = match[1]; } } - if (!name && instance && instance.parent) { + if (!name2 && instance && instance.parent) { const inferFromRegistry = (registry) => { for (const key in registry) { if (registry[key] === Component2) { @@ -2100,14 +2341,14 @@ function formatComponentName$1(instance, Component2, isRoot = false) { } } }; - name = inferFromRegistry( + name2 = inferFromRegistry( instance.components || instance.parent.type.components ) || inferFromRegistry(instance.appContext.components); } - return name ? classify$1(name) : isRoot ? `App` : `Anonymous`; + return name2 ? classify$1(name2) : isRoot ? `App` : `Anonymous`; } function isClassComponent$1(value) { - return isFunction(value) && "__vccOpts" in value; + return isFunction$1(value) && "__vccOpts" in value; } /** * @dcloudio/uni-mp-vue v3.4.21 @@ -2163,16 +2404,16 @@ class EffectScope { } stop(fromParent) { if (this._active) { - let i, l; - for (i = 0, l = this.effects.length; i < l; i++) { - this.effects[i].stop(); + let i2, l2; + for (i2 = 0, l2 = this.effects.length; i2 < l2; i2++) { + this.effects[i2].stop(); } - for (i = 0, l = this.cleanups.length; i < l; i++) { - this.cleanups[i](); + for (i2 = 0, l2 = this.cleanups.length; i2 < l2; i2++) { + this.cleanups[i2](); } if (this.scopes) { - for (i = 0, l = this.scopes.length; i < l; i++) { - this.scopes[i].stop(true); + for (i2 = 0, l2 = this.scopes.length; i2 < l2; i2++) { + this.scopes[i2].stop(true); } } if (!this.detached && this.parent && !fromParent) { @@ -2198,15 +2439,6 @@ function recordEffectScope(effect2, scope = activeEffectScope) { function getCurrentScope() { return activeEffectScope; } -function onScopeDispose(fn) { - if (activeEffectScope) { - activeEffectScope.cleanups.push(fn); - } else { - warn$2( - `onScopeDispose() is called when there is no active effect scope to be associated with.` - ); - } -} let activeEffect; class ReactiveEffect2 { constructor(fn, trigger2, scheduler, scope) { @@ -2226,8 +2458,8 @@ class ReactiveEffect2 { if (this._dirtyLevel === 2 || this._dirtyLevel === 3) { this._dirtyLevel = 1; pauseTracking(); - for (let i = 0; i < this._depsLength; i++) { - const dep = this.deps[i]; + for (let i2 = 0; i2 < this._depsLength; i2++) { + const dep = this.deps[i2]; if (dep.computed) { triggerComputed(dep.computed); if (this._dirtyLevel >= 4) { @@ -2242,8 +2474,8 @@ class ReactiveEffect2 { } return this._dirtyLevel >= 4; } - set dirty(v) { - this._dirtyLevel = v ? 4 : 0; + set dirty(v2) { + this._dirtyLevel = v2 ? 4 : 0; } run() { this._dirtyLevel = 0; @@ -2284,8 +2516,8 @@ function preCleanupEffect(effect2) { } function postCleanupEffect(effect2) { if (effect2.deps.length > effect2._depsLength) { - for (let i = effect2._depsLength; i < effect2.deps.length; i++) { - cleanupDepEffect(effect2.deps[i], effect2); + for (let i2 = effect2._depsLength; i2 < effect2.deps.length; i2++) { + cleanupDepEffect(effect2.deps[i2], effect2); } effect2.deps.length = effect2._depsLength; } @@ -2400,7 +2632,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) { let deps = []; if (type === "clear") { deps = [...depsMap.values()]; - } else if (key === "length" && isArray(target)) { + } else if (key === "length" && isArray$1(target)) { const newLength = Number(newValue); depsMap.forEach((dep, key2) => { if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) { @@ -2413,9 +2645,9 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) { } switch (type) { case "add": - if (!isArray(target)) { + if (!isArray$1(target)) { deps.push(depsMap.get(ITERATE_KEY)); - if (isMap(target)) { + if (isMap$1(target)) { deps.push(depsMap.get(MAP_KEY_ITERATE_KEY)); } } else if (isIntegerKey(key)) { @@ -2423,15 +2655,15 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) { } break; case "delete": - if (!isArray(target)) { + if (!isArray$1(target)) { deps.push(depsMap.get(ITERATE_KEY)); - if (isMap(target)) { + if (isMap$1(target)) { deps.push(depsMap.get(MAP_KEY_ITERATE_KEY)); } } break; case "set": - if (isMap(target)) { + if (isMap$1(target)) { deps.push(depsMap.get(ITERATE_KEY)); } break; @@ -2456,10 +2688,6 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) { } resetScheduling(); } -function getDepFromReactive(object, key) { - var _a; - return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key); -} const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`); const builtInSymbols = new Set( /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol) @@ -2470,8 +2698,8 @@ function createArrayInstrumentations() { ["includes", "indexOf", "lastIndexOf"].forEach((key) => { instrumentations[key] = function(...args) { const arr = toRaw(this); - for (let i = 0, l = this.length; i < l; i++) { - track(arr, "get", i + ""); + for (let i2 = 0, l2 = this.length; i2 < l2; i2++) { + track(arr, "get", i2 + ""); } const res = arr[key](...args); if (res === -1 || res === false) { @@ -2493,7 +2721,7 @@ function createArrayInstrumentations() { }); return instrumentations; } -function hasOwnProperty(key) { +function hasOwnProperty$1(key) { const obj = toRaw(this); track(obj, "has", key); return obj.hasOwnProperty(key); @@ -2519,13 +2747,13 @@ class BaseReactiveHandler2 { } return; } - const targetIsArray = isArray(target); + const targetIsArray = isArray$1(target); if (!isReadonly2) { - if (targetIsArray && hasOwn(arrayInstrumentations, key)) { + if (targetIsArray && hasOwn$1(arrayInstrumentations, key)) { return Reflect.get(arrayInstrumentations, key, receiver); } if (key === "hasOwnProperty") { - return hasOwnProperty; + return hasOwnProperty$1; } } const res = Reflect.get(target, key, receiver); @@ -2541,7 +2769,7 @@ class BaseReactiveHandler2 { if (isRef(res)) { return targetIsArray && isIntegerKey(key) ? res : res.value; } - if (isObject(res)) { + if (isObject$2(res)) { return isReadonly2 ? readonly(res) : reactive(res); } return res; @@ -2559,7 +2787,7 @@ class MutableReactiveHandler2 extends BaseReactiveHandler2 { oldValue = toRaw(oldValue); value = toRaw(value); } - if (!isArray(target) && isRef(oldValue) && !isRef(value)) { + if (!isArray$1(target) && isRef(oldValue) && !isRef(value)) { if (isOldValueReadonly) { return false; } else { @@ -2568,7 +2796,7 @@ class MutableReactiveHandler2 extends BaseReactiveHandler2 { } } } - const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key); + const hadKey = isArray$1(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn$1(target, key); const result = Reflect.set(target, key, value, receiver); if (target === toRaw(receiver)) { if (!hadKey) { @@ -2580,7 +2808,7 @@ class MutableReactiveHandler2 extends BaseReactiveHandler2 { return result; } deleteProperty(target, key) { - const hadKey = hasOwn(target, key); + const hadKey = hasOwn$1(target, key); const oldValue = target[key]; const result = Reflect.deleteProperty(target, key); if (result && hadKey) { @@ -2599,7 +2827,7 @@ class MutableReactiveHandler2 extends BaseReactiveHandler2 { track( target, "iterate", - isArray(target) ? "length" : ITERATE_KEY + isArray$1(target) ? "length" : ITERATE_KEY ); return Reflect.ownKeys(target); } @@ -2634,8 +2862,8 @@ const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler2( ); const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler2(true); const toShallow = (value) => value; -const getProto = (v) => Reflect.getPrototypeOf(v); -function get(target, key, isReadonly2 = false, isShallow2 = false) { +const getProto = (v2) => Reflect.getPrototypeOf(v2); +function get$1(target, key, isReadonly2 = false, isShallow2 = false) { target = target["__v_raw"]; const rawTarget = toRaw(target); const rawKey = toRaw(key); @@ -2672,7 +2900,7 @@ function size(target, isReadonly2 = false) { !isReadonly2 && track(toRaw(target), "iterate", ITERATE_KEY); return Reflect.get(target, "size", target); } -function add(value) { +function add$1(value) { value = toRaw(value); const target = toRaw(this); const proto = getProto(target); @@ -2723,7 +2951,7 @@ function deleteEntry(key) { function clear() { const target = toRaw(this); const hadItems = target.size !== 0; - const oldTarget = isMap(target) ? new Map(target) : new Set(target); + const oldTarget = isMap$1(target) ? new Map(target) : new Set(target); const result = target.clear(); if (hadItems) { trigger(target, "clear", void 0, void 0, oldTarget); @@ -2746,7 +2974,7 @@ function createIterableMethod(method, isReadonly2, isShallow2) { return function(...args) { const target = this["__v_raw"]; const rawTarget = toRaw(target); - const targetIsMap = isMap(rawTarget); + const targetIsMap = isMap$1(rawTarget); const isPair = method === "entries" || method === Symbol.iterator && targetIsMap; const isKeyOnly = method === "keys" && targetIsMap; const innerIterator = target[method](...args); @@ -2787,13 +3015,13 @@ function createReadonlyMethod(type) { function createInstrumentations() { const mutableInstrumentations2 = { get(key) { - return get(this, key); + return get$1(this, key); }, get size() { return size(this); }, has, - add, + add: add$1, set: set$1, delete: deleteEntry, clear, @@ -2801,13 +3029,13 @@ function createInstrumentations() { }; const shallowInstrumentations2 = { get(key) { - return get(this, key, false, true); + return get$1(this, key, false, true); }, get size() { return size(this); }, has, - add, + add: add$1, set: set$1, delete: deleteEntry, clear, @@ -2815,7 +3043,7 @@ function createInstrumentations() { }; const readonlyInstrumentations2 = { get(key) { - return get(this, key, true); + return get$1(this, key, true); }, get size() { return size(this, true); @@ -2831,7 +3059,7 @@ function createInstrumentations() { }; const shallowReadonlyInstrumentations2 = { get(key) { - return get(this, key, true, true); + return get$1(this, key, true, true); }, get size() { return size(this, true); @@ -2885,7 +3113,7 @@ function createInstrumentationGetter(isReadonly2, shallow) { return target; } return Reflect.get( - hasOwn(instrumentations, key) && key in target ? instrumentations : target, + hasOwn$1(instrumentations, key) && key in target ? instrumentations : target, key, receiver ); @@ -2973,7 +3201,7 @@ function shallowReadonly(target) { ); } function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) { - if (!isObject(target)) { + if (!isObject$2(target)) { { warn$2(`value cannot be made reactive: ${String(target)}`); } @@ -3022,8 +3250,8 @@ function markRaw(value) { } return value; } -const toReactive = (value) => isObject(value) ? reactive(value) : value; -const toReadonly = (value) => isObject(value) ? readonly(value) : value; +const toReactive = (value) => isObject$2(value) ? reactive(value) : value; +const toReadonly = (value) => isObject$2(value) ? readonly(value) : value; const COMPUTED_SIDE_EFFECT_WARN = `Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free`; class ComputedRefImpl { constructor(getter, _setter, isReadonly2, isSSR) { @@ -3066,15 +3294,15 @@ getter: `, this.getter); get _dirty() { return this.effect.dirty; } - set _dirty(v) { - this.effect.dirty = v; + set _dirty(v2) { + this.effect.dirty = v2; } // #endregion } function computed$1(getterOrOptions, debugOptions, isSSR = false) { let getter; let setter; - const onlyGetter = isFunction(getterOrOptions); + const onlyGetter = isFunction$1(getterOrOptions); if (onlyGetter) { getter = getterOrOptions; setter = () => { @@ -3177,59 +3405,6 @@ const shallowUnwrapHandlers = { function proxyRefs(objectWithRefs) { return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers); } -function toRefs(object) { - if (!isProxy(object)) { - warn$2(`toRefs() expects a reactive object but received a plain one.`); - } - const ret = isArray(object) ? new Array(object.length) : {}; - for (const key in object) { - ret[key] = propertyToRef(object, key); - } - return ret; -} -class ObjectRefImpl { - constructor(_object, _key, _defaultValue) { - this._object = _object; - this._key = _key; - this._defaultValue = _defaultValue; - this.__v_isRef = true; - } - get value() { - const val = this._object[this._key]; - return val === void 0 ? this._defaultValue : val; - } - set value(newVal) { - this._object[this._key] = newVal; - } - get dep() { - return getDepFromReactive(toRaw(this._object), this._key); - } -} -class GetterRefImpl { - constructor(_getter) { - this._getter = _getter; - this.__v_isRef = true; - this.__v_isReadonly = true; - } - get value() { - return this._getter(); - } -} -function toRef(source, key, defaultValue) { - if (isRef(source)) { - return source; - } else if (isFunction(source)) { - return new GetterRefImpl(source); - } else if (isObject(source) && arguments.length > 1) { - return propertyToRef(source, key, defaultValue); - } else { - return ref(source); - } -} -function propertyToRef(source, key, defaultValue) { - const val = source[key]; - return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue); -} const stack = []; function pushWarningContext(vnode) { stack.push(vnode); @@ -3248,9 +3423,9 @@ function warn$1(msg, ...args) { instance, 11, [ - msg + args.map((a) => { + msg + args.map((a2) => { var _a, _b; - return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a); + return (_b = (_a = a2.toString) == null ? void 0 : _a.call(a2)) != null ? _b : JSON.stringify(a2); }).join(""), instance && instance.proxy, trace.map( @@ -3293,8 +3468,8 @@ function getComponentTrace() { } function formatTrace(trace) { const logs = []; - trace.forEach((entry, i) => { - logs.push(...i === 0 ? [] : [` + trace.forEach((entry, i2) => { + logs.push(...i2 === 0 ? [] : [` `], ...formatTraceEntry(entry)); }); return logs; @@ -3322,7 +3497,7 @@ function formatProps(props) { return res; } function formatProp(key, value, raw) { - if (isString(value)) { + if (isString$1(value)) { value = JSON.stringify(value); return raw ? value : [`${key}=${value}`]; } else if (typeof value === "number" || typeof value === "boolean" || value == null) { @@ -3330,7 +3505,7 @@ function formatProp(key, value, raw) { } else if (isRef(value)) { value = formatProp(key, toRaw(value.value), true); return raw ? value : [`${key}=Ref<`, value, `>`]; - } else if (isFunction(value)) { + } else if (isFunction$1(value)) { return [`${key}=fn${value.name ? `<${value.name}>` : ``}`]; } else { value = toRaw(value); @@ -3376,7 +3551,7 @@ function callWithErrorHandling(fn, instance, type, args) { } } function callWithAsyncErrorHandling(fn, instance, type, args) { - if (isFunction(fn)) { + if (isFunction$1(fn)) { const res = callWithErrorHandling(fn, instance, type, args); if (res && isPromise(res)) { res.catch((err) => { @@ -3386,8 +3561,8 @@ function callWithAsyncErrorHandling(fn, instance, type, args) { return res; } const values = []; - for (let i = 0; i < fn.length; i++) { - values.push(callWithAsyncErrorHandling(fn[i], instance, type, args)); + for (let i2 = 0; i2 < fn.length; i2++) { + values.push(callWithAsyncErrorHandling(fn[i2], instance, type, args)); } return values; } @@ -3400,8 +3575,8 @@ function handleError(err, instance, type, throwInDev = true) { while (cur) { const errorCapturedHooks = cur.ec; if (errorCapturedHooks) { - for (let i = 0; i < errorCapturedHooks.length; i++) { - if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) { + for (let i2 = 0; i2 < errorCapturedHooks.length; i2++) { + if (errorCapturedHooks[i2](err, exposedInstance, errorInfo) === false) { return; } } @@ -3490,13 +3665,13 @@ function hasQueueJob(job) { return queue.indexOf(job) > -1; } function invalidateJob(job) { - const i = queue.indexOf(job); - if (i > flushIndex) { - queue.splice(i, 1); + const i2 = queue.indexOf(job); + if (i2 > flushIndex) { + queue.splice(i2, 1); } } function queuePostFlushCb(cb) { - if (!isArray(cb)) { + if (!isArray$1(cb)) { if (!activePostFlushCbs || !activePostFlushCbs.includes( cb, cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex @@ -3508,12 +3683,12 @@ function queuePostFlushCb(cb) { } queueFlush(); } -function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) { +function flushPreFlushCbs(instance, seen, i2 = isFlushing ? flushIndex + 1 : 0) { { seen = seen || /* @__PURE__ */ new Map(); } - for (; i < queue.length; i++) { - const cb = queue[i]; + for (; i2 < queue.length; i2++) { + const cb = queue[i2]; if (cb && cb.pre) { if (instance && cb.id !== instance.uid) { continue; @@ -3521,8 +3696,8 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) { if (checkRecursiveUpdates(seen, cb)) { continue; } - queue.splice(i, 1); - i--; + queue.splice(i2, 1); + i2--; cb(); } } @@ -3530,7 +3705,7 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) { function flushPostFlushCbs(seen) { if (pendingPostFlushCbs.length) { const deduped = [...new Set(pendingPostFlushCbs)].sort( - (a, b) => getId(a) - getId(b) + (a2, b2) => getId(a2) - getId(b2) ); pendingPostFlushCbs.length = 0; if (activePostFlushCbs) { @@ -3552,12 +3727,12 @@ function flushPostFlushCbs(seen) { } } const getId = (job) => job.id == null ? Infinity : job.id; -const comparator = (a, b) => { - const diff2 = getId(a) - getId(b); +const comparator = (a2, b2) => { + const diff2 = getId(a2) - getId(b2); if (diff2 === 0) { - if (a.pre && !b.pre) + if (a2.pre && !b2.pre) return -1; - if (b.pre && !a.pre) + if (b2.pre && !a2.pre) return 1; } return diff2; @@ -3732,7 +3907,7 @@ function emit(instance, event, ...rawArgs) { } } else { const validator = emitsOptions[event]; - if (isFunction(validator)) { + if (isFunction$1(validator)) { const isValid = validator(...rawArgs); if (!isValid) { warn$1( @@ -3750,7 +3925,7 @@ function emit(instance, event, ...rawArgs) { const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`; const { number, trim } = props[modifiersKey] || EMPTY_OBJ; if (trim) { - args = rawArgs.map((a) => isString(a) ? a.trim() : a); + args = rawArgs.map((a2) => isString$1(a2) ? a2.trim() : a2); } if (number) { args = rawArgs.map(looseToNumber); @@ -3811,7 +3986,7 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) { const raw = comp.emits; let normalized = {}; let hasExtends = false; - if (!isFunction(comp)) { + if (!isFunction$1(comp)) { const extendEmits = (raw2) => { const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true); if (normalizedFromExtend) { @@ -3830,17 +4005,17 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) { } } if (!raw && !hasExtends) { - if (isObject(comp)) { + if (isObject$2(comp)) { cache.set(comp, null); } return null; } - if (isArray(raw)) { + if (isArray$1(raw)) { raw.forEach((key) => normalized[key] = null); } else { extend(normalized, raw); } - if (isObject(comp)) { + if (isObject$2(comp)) { cache.set(comp, normalized); } return normalized; @@ -3850,7 +4025,7 @@ function isEmitListener(options, key) { return false; } key = key.slice(2).replace(/Once$/, ""); - return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key); + return hasOwn$1(options, key[0].toLowerCase() + key.slice(1)) || hasOwn$1(options, hyphenate(key)) || hasOwn$1(options, key); } let currentRenderingInstance = null; function setCurrentRenderingInstance(instance) { @@ -3860,10 +4035,10 @@ function setCurrentRenderingInstance(instance) { return prev; } const COMPONENTS = "components"; -function resolveComponent(name, maybeSelfReference) { - return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name; +function resolveComponent(name2, maybeSelfReference) { + return resolveAsset(COMPONENTS, name2, true, maybeSelfReference) || name2; } -function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) { +function resolveAsset(type, name2, warnMissing = true, maybeSelfReference = false) { const instance = currentRenderingInstance || currentInstance; if (instance) { const Component2 = instance.type; @@ -3872,15 +4047,15 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false Component2, false ); - if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) { + if (selfName && (selfName === name2 || selfName === camelize(name2) || selfName === capitalize(camelize(name2)))) { return Component2; } } const res = ( // local registration // check instance[type] first which is resolved for options API - resolve(instance[type] || Component2[type], name) || // global registration - resolve(instance.appContext[type], name) + resolve(instance[type] || Component2[type], name2) || // global registration + resolve(instance.appContext[type], name2) ); if (!res && maybeSelfReference) { return Component2; @@ -3888,7 +4063,7 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false if (warnMissing && !res) { const extra = type === COMPONENTS ? ` If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``; - warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`); + warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name2}${extra}`); } return res; } else { @@ -3897,12 +4072,12 @@ If this is a native custom element, make sure to exclude it from component resol ); } } -function resolve(registry, name) { - return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]); +function resolve(registry, name2) { + return registry && (registry[name2] || registry[camelize(name2)] || registry[capitalize(camelize(name2))]); } const INITIAL_WATCHER_VALUE = {}; function watch(source, cb, options) { - if (!isFunction(cb)) { + if (!isFunction$1(cb)) { warn$1( `\`watch(fn, options?)\` signature has been moved to a separate API. Use \`watchEffect(fn, options?)\` instead. \`watch\` now only supports \`watch(source, cb, options?) signature.` ); @@ -3967,7 +4142,7 @@ function doWatch(source, cb, { } else if (isReactive(source)) { getter = () => reactiveGetter(source); forceTrigger = true; - } else if (isArray(source)) { + } else if (isArray$1(source)) { isMultiSource = true; forceTrigger = source.some((s2) => isReactive(s2) || isShallow(s2)); getter = () => source.map((s2) => { @@ -3975,13 +4150,13 @@ function doWatch(source, cb, { return s2.value; } else if (isReactive(s2)) { return reactiveGetter(s2); - } else if (isFunction(s2)) { + } else if (isFunction$1(s2)) { return callWithErrorHandling(s2, instance, 2); } else { warnInvalidSource(s2); } }); - } else if (isFunction(source)) { + } else if (isFunction$1(source)) { if (cb) { getter = () => callWithErrorHandling(source, instance, 2); } else { @@ -4019,7 +4194,7 @@ function doWatch(source, cb, { } if (cb) { const newValue = effect2.run(); - if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) { + if (deep || forceTrigger || (isMultiSource ? newValue.some((v2, i2) => hasChanged(v2, oldValue[i2])) : hasChanged(newValue, oldValue)) || false) { if (cleanup) { cleanup(); } @@ -4077,9 +4252,9 @@ function doWatch(source, cb, { } function instanceWatch(source, value, options) { const publicThis = this.proxy; - const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis); + const getter = isString$1(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis); let cb; - if (isFunction(value)) { + if (isFunction$1(value)) { cb = value; } else { cb = value.handler; @@ -4094,14 +4269,14 @@ function createPathGetter(ctx, path) { const segments = path.split("."); return () => { let cur = ctx; - for (let i = 0; i < segments.length && cur; i++) { - cur = cur[segments[i]]; + for (let i2 = 0; i2 < segments.length && cur; i2++) { + cur = cur[segments[i2]]; } return cur; }; } function traverse(value, depth, currentDepth = 0, seen) { - if (!isObject(value) || value["__v_skip"]) { + if (!isObject$2(value) || value["__v_skip"]) { return value; } if (depth && depth > 0) { @@ -4117,13 +4292,13 @@ function traverse(value, depth, currentDepth = 0, seen) { seen.add(value); if (isRef(value)) { traverse(value.value, depth, currentDepth, seen); - } else if (isArray(value)) { - for (let i = 0; i < value.length; i++) { - traverse(value[i], depth, currentDepth, seen); + } else if (isArray$1(value)) { + for (let i2 = 0; i2 < value.length; i2++) { + traverse(value[i2], depth, currentDepth, seen); } - } else if (isSet(value) || isMap(value)) { - value.forEach((v) => { - traverse(v, depth, currentDepth, seen); + } else if (isSet(value) || isMap$1(value)) { + value.forEach((v2) => { + traverse(v2, depth, currentDepth, seen); }); } else if (isPlainObject$1(value)) { for (const key in value) { @@ -4132,9 +4307,9 @@ function traverse(value, depth, currentDepth = 0, seen) { } return value; } -function validateDirectiveName(name) { - if (isBuiltInDirective(name)) { - warn$1("Do not use built-in directive ids as custom directive id: " + name); +function validateDirectiveName(name2) { + if (isBuiltInDirective(name2)) { + warn$1("Do not use built-in directive ids as custom directive id: " + name2); } } function createAppContext() { @@ -4161,10 +4336,10 @@ function createAppContext() { let uid$1 = 0; function createAppAPI(render, hydrate) { return function createApp2(rootComponent, rootProps = null) { - if (!isFunction(rootComponent)) { + if (!isFunction$1(rootComponent)) { rootComponent = extend({}, rootComponent); } - if (rootProps != null && !isObject(rootProps)) { + if (rootProps != null && !isObject$2(rootProps)) { warn$1(`root props passed to app.mount() must be an object.`); rootProps = null; } @@ -4181,7 +4356,7 @@ function createAppAPI(render, hydrate) { get config() { return context.config; }, - set config(v) { + set config(v2) { { warn$1( `app.config cannot be replaced. Modify individual options instead.` @@ -4191,10 +4366,10 @@ function createAppAPI(render, hydrate) { use(plugin2, ...options) { if (installedPlugins.has(plugin2)) { warn$1(`Plugin has already been applied to target app.`); - } else if (plugin2 && isFunction(plugin2.install)) { + } else if (plugin2 && isFunction$1(plugin2.install)) { installedPlugins.add(plugin2); plugin2.install(app, ...options); - } else if (isFunction(plugin2)) { + } else if (isFunction$1(plugin2)) { installedPlugins.add(plugin2); plugin2(app, ...options); } else { @@ -4216,30 +4391,30 @@ function createAppAPI(render, hydrate) { } return app; }, - component(name, component) { + component(name2, component) { { - validateComponentName(name, context.config); + validateComponentName(name2, context.config); } if (!component) { - return context.components[name]; + return context.components[name2]; } - if (context.components[name]) { - warn$1(`Component "${name}" has already been registered in target app.`); + if (context.components[name2]) { + warn$1(`Component "${name2}" has already been registered in target app.`); } - context.components[name] = component; + context.components[name2] = component; return app; }, - directive(name, directive) { + directive(name2, directive) { { - validateDirectiveName(name); + validateDirectiveName(name2); } if (!directive) { - return context.directives[name]; + return context.directives[name2]; } - if (context.directives[name]) { - warn$1(`Directive "${name}" has already been registered in target app.`); + if (context.directives[name2]) { + warn$1(`Directive "${name2}" has already been registered in target app.`); } - context.directives[name] = directive; + context.directives[name2] = directive; return app; }, // fixed by xxxxxx @@ -4295,7 +4470,7 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) { if (provides && key in provides) { return provides[key]; } else if (arguments.length > 1) { - return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue; + return treatDefaultAsFactory && isFunction$1(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue; } else { warn$1(`injection "${String(key)}" not found.`); } @@ -4303,13 +4478,10 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) { warn$1(`inject() can only be used inside setup() or functional components.`); } } -function hasInjectionContext() { - return !!(currentInstance || currentRenderingInstance || currentApp); -} /*! #__NO_SIDE_EFFECTS__ */ // @__NO_SIDE_EFFECTS__ function defineComponent(options, extraOptions) { - return isFunction(options) ? ( + return isFunction$1(options) ? ( // #8326: extend call and options.name access are considered side-effects // by Rollup, so we have to wrap it in a pure-annotated IIFE. /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))() @@ -4408,40 +4580,40 @@ const onRenderTracked = createHook$1( function onErrorCaptured(hook, target = currentInstance) { injectHook("ec", hook, target); } -const getPublicInstance = (i) => { - if (!i) +const getPublicInstance = (i2) => { + if (!i2) return null; - if (isStatefulComponent(i)) - return getExposeProxy(i) || i.proxy; - return getPublicInstance(i.parent); + if (isStatefulComponent(i2)) + return getExposeProxy(i2) || i2.proxy; + return getPublicInstance(i2.parent); }; const publicPropertiesMap = ( // Move PURE marker to new line to workaround compiler discarding it // due to type annotation /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), { - $: (i) => i, + $: (i2) => i2, // fixed by xxxxxx vue-i18n 在 dev 模式,访问了 $el,故模拟一个假的 // $el: i => i.vnode.el, - $el: (i) => i.__$el || (i.__$el = {}), - $data: (i) => i.data, - $props: (i) => shallowReadonly(i.props), - $attrs: (i) => shallowReadonly(i.attrs), - $slots: (i) => shallowReadonly(i.slots), - $refs: (i) => shallowReadonly(i.refs), - $parent: (i) => getPublicInstance(i.parent), - $root: (i) => getPublicInstance(i.root), - $emit: (i) => i.emit, - $options: (i) => resolveMergedOptions(i), - $forceUpdate: (i) => i.f || (i.f = () => { - i.effect.dirty = true; - queueJob(i.update); + $el: (i2) => i2.__$el || (i2.__$el = {}), + $data: (i2) => i2.data, + $props: (i2) => shallowReadonly(i2.props), + $attrs: (i2) => shallowReadonly(i2.attrs), + $slots: (i2) => shallowReadonly(i2.slots), + $refs: (i2) => shallowReadonly(i2.refs), + $parent: (i2) => getPublicInstance(i2.parent), + $root: (i2) => getPublicInstance(i2.root), + $emit: (i2) => i2.emit, + $options: (i2) => resolveMergedOptions(i2), + $forceUpdate: (i2) => i2.f || (i2.f = () => { + i2.effect.dirty = true; + queueJob(i2.update); }), // $nextTick: i => i.n || (i.n = nextTick.bind(i.proxy!)),// fixed by xxxxxx - $watch: (i) => instanceWatch.bind(i) + $watch: (i2) => instanceWatch.bind(i2) }) ); const isReservedPrefix = (key) => key === "_" || key === "$"; -const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key); +const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn$1(state, key); const PublicInstanceProxyHandlers = { get({ _: instance }, key) { const { ctx, setupState, data, props, accessCache, type, appContext } = instance; @@ -4465,17 +4637,17 @@ const PublicInstanceProxyHandlers = { } else if (hasSetupBinding(setupState, key)) { accessCache[key] = 1; return setupState[key]; - } else if (data !== EMPTY_OBJ && hasOwn(data, key)) { + } else if (data !== EMPTY_OBJ && hasOwn$1(data, key)) { accessCache[key] = 2; return data[key]; } else if ( // only cache other properties when instance has declared (thus stable) // props - (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key) + (normalizedProps = instance.propsOptions[0]) && hasOwn$1(normalizedProps, key) ) { accessCache[key] = 3; return props[key]; - } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) { + } else if (ctx !== EMPTY_OBJ && hasOwn$1(ctx, key)) { accessCache[key] = 4; return ctx[key]; } else if (shouldCacheAccess) { @@ -4496,20 +4668,20 @@ const PublicInstanceProxyHandlers = { (cssModule = type.__cssModules) && (cssModule = cssModule[key]) ) { return cssModule; - } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) { + } else if (ctx !== EMPTY_OBJ && hasOwn$1(ctx, key)) { accessCache[key] = 4; return ctx[key]; } else if ( // global properties - globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key) + globalProperties = appContext.config.globalProperties, hasOwn$1(globalProperties, key) ) { { return globalProperties[key]; } - } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading + } else if (currentRenderingInstance && (!isString$1(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading // to infinite warning loop key.indexOf("__v") !== 0)) { - if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) { + if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn$1(data, key)) { warn$1( `Property ${JSON.stringify( key @@ -4527,13 +4699,13 @@ const PublicInstanceProxyHandlers = { if (hasSetupBinding(setupState, key)) { setupState[key] = value; return true; - } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) { + } else if (setupState.__isScriptSetup && hasOwn$1(setupState, key)) { warn$1(`Cannot mutate