@cortex-js/compute-engine 0.69.0 → 0.69.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{chunk-T44CNE4L.js → chunk-QIFCLIET.js} +1 -1
- package/dist/chunks/{chunk-ZQVRT3JA.js → chunk-TWCY5EYT.js} +1 -1
- package/dist/compile.esm.js +2 -2
- package/dist/compile.min.esm.js +2 -2
- package/dist/compile.min.umd.cjs +2 -2
- package/dist/compile.umd.cjs +2 -2
- package/dist/compute-engine.esm.js +4 -4
- package/dist/compute-engine.min.esm.js +3 -3
- package/dist/compute-engine.min.umd.cjs +2 -2
- package/dist/compute-engine.umd.cjs +3 -3
- package/dist/core.esm.js +2 -2
- package/dist/core.min.esm.js +2 -2
- package/dist/core.min.umd.cjs +2 -2
- package/dist/core.umd.cjs +2 -2
- package/dist/identities.esm.js +2 -2
- package/dist/identities.min.esm.js +2 -2
- package/dist/identities.min.umd.cjs +2 -2
- package/dist/identities.umd.cjs +2 -2
- package/dist/integration-rules.esm.js +3 -3
- package/dist/integration-rules.min.esm.js +3 -3
- package/dist/integration-rules.min.umd.cjs +2 -2
- package/dist/integration-rules.umd.cjs +2 -2
- package/dist/interval.esm.js +2 -2
- package/dist/interval.min.esm.js +2 -2
- package/dist/interval.min.umd.cjs +2 -2
- package/dist/interval.umd.cjs +2 -2
- package/dist/latex-syntax.esm.js +2 -2
- package/dist/latex-syntax.min.esm.js +2 -2
- package/dist/latex-syntax.min.umd.cjs +2 -2
- package/dist/latex-syntax.umd.cjs +2 -2
- package/dist/math-json.esm.js +2 -2
- package/dist/math-json.min.esm.js +2 -2
- package/dist/math-json.min.umd.cjs +2 -2
- package/dist/math-json.umd.cjs +2 -2
- package/dist/numerics.esm.js +2 -2
- package/dist/numerics.min.esm.js +2 -2
- package/dist/numerics.min.umd.cjs +2 -2
- package/dist/numerics.umd.cjs +2 -2
- package/dist/types/big-decimal/big-decimal.d.ts +2 -2
- package/dist/types/big-decimal/index.d.ts +2 -2
- package/dist/types/big-decimal/transcendentals.d.ts +2 -2
- package/dist/types/big-decimal/utils.d.ts +1 -1
- package/dist/types/common/ansi-codes.d.ts +1 -1
- package/dist/types/common/configuration-change.d.ts +1 -1
- package/dist/types/common/fuzzy-string-match.d.ts +1 -1
- package/dist/types/common/grapheme-splitter.d.ts +1 -1
- package/dist/types/common/interruptible.d.ts +1 -1
- package/dist/types/common/one-of.d.ts +1 -1
- package/dist/types/common/signals.d.ts +1 -1
- package/dist/types/common/type/ast-nodes.d.ts +1 -1
- package/dist/types/common/type/boxed-type.d.ts +1 -1
- package/dist/types/common/type/lexer.d.ts +1 -1
- package/dist/types/common/type/parse.d.ts +1 -1
- package/dist/types/common/type/parser.d.ts +3 -3
- package/dist/types/common/type/primitive.d.ts +1 -1
- package/dist/types/common/type/reduce.d.ts +1 -1
- package/dist/types/common/type/serialize.d.ts +1 -1
- package/dist/types/common/type/subtype.d.ts +1 -1
- package/dist/types/common/type/type-builder.d.ts +2 -2
- package/dist/types/common/type/types.d.ts +1 -1
- package/dist/types/common/type/utils.d.ts +3 -3
- package/dist/types/common/utils.d.ts +1 -1
- package/dist/types/compile.d.ts +11 -11
- package/dist/types/compute-engine/assume.d.ts +3 -3
- package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +8 -8
- package/dist/types/compute-engine/boxed-expression/apply.d.ts +3 -3
- package/dist/types/compute-engine/boxed-expression/arithmetic-add.d.ts +3 -3
- package/dist/types/compute-engine/boxed-expression/arithmetic-mul-div.d.ts +3 -3
- package/dist/types/compute-engine/boxed-expression/arithmetic-power.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/ascii-math.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/box.d.ts +4 -4
- package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +4 -4
- package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +6 -6
- package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +8 -8
- package/dist/types/compute-engine/boxed-expression/boxed-operator-definition.d.ts +3 -3
- package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +3 -3
- package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +3 -3
- package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +8 -8
- package/dist/types/compute-engine/boxed-expression/boxed-tensor.d.ts +5 -5
- package/dist/types/compute-engine/boxed-expression/boxed-value-definition.d.ts +4 -4
- package/dist/types/compute-engine/boxed-expression/cache.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/canonical-utils.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/canonical.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/compare.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/constants.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/constraint-subject.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/diophantine.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/exp-to-trig.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/expand.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/explain-labels.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/explain.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/factor.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/flatten.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/hold.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/inequality-bounds.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/init-lazy-refs.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/invisible-operator.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/match.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/multivariate-gcd.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/multivariate-poly.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/negate.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/numerics.d.ts +4 -4
- package/dist/types/compute-engine/boxed-expression/order.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/pattern-utils.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/polynomial-degree.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/polynomials.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/predicates.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/rule-index.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/rules.d.ts +4 -4
- package/dist/types/compute-engine/boxed-expression/serialize.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/sgn.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/simplify.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/solve-domain.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/solve-linear-system.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/solve.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/stochastic-equal.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/type-guards.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/utils.d.ts +3 -3
- package/dist/types/compute-engine/boxed-expression/validate.d.ts +2 -2
- package/dist/types/compute-engine/collection-utils.d.ts +1 -1
- package/dist/types/compute-engine/compilation/base-compiler.d.ts +2 -2
- package/dist/types/compute-engine/compilation/compile-expression.d.ts +3 -3
- package/dist/types/compute-engine/compilation/constant-folding.d.ts +2 -2
- package/dist/types/compute-engine/compilation/glsl-target.d.ts +3 -3
- package/dist/types/compute-engine/compilation/gpu-target.d.ts +2 -2
- package/dist/types/compute-engine/compilation/interval-glsl-target.d.ts +3 -3
- package/dist/types/compute-engine/compilation/interval-javascript-target.d.ts +98 -98
- package/dist/types/compute-engine/compilation/javascript-target.d.ts +6 -6
- package/dist/types/compute-engine/compilation/python-target.d.ts +2 -2
- package/dist/types/compute-engine/compilation/types.d.ts +1 -1
- package/dist/types/compute-engine/compilation/wgsl-target.d.ts +3 -3
- package/dist/types/compute-engine/cost-function.d.ts +1 -1
- package/dist/types/compute-engine/differential-equation-utils.d.ts +1 -1
- package/dist/types/compute-engine/engine-assumptions.d.ts +2 -2
- package/dist/types/compute-engine/engine-cache.d.ts +1 -1
- package/dist/types/compute-engine/engine-common-symbols.d.ts +1 -1
- package/dist/types/compute-engine/engine-compilation-targets.d.ts +2 -2
- package/dist/types/compute-engine/engine-configuration-lifecycle.d.ts +1 -1
- package/dist/types/compute-engine/engine-declarations.d.ts +4 -4
- package/dist/types/compute-engine/engine-expression-entrypoints.d.ts +7 -7
- package/dist/types/compute-engine/engine-extension-contracts.d.ts +2 -2
- package/dist/types/compute-engine/engine-library-bootstrap.d.ts +1 -1
- package/dist/types/compute-engine/engine-numeric-configuration.d.ts +2 -2
- package/dist/types/compute-engine/engine-runtime-state.d.ts +1 -1
- package/dist/types/compute-engine/engine-scope.d.ts +1 -1
- package/dist/types/compute-engine/engine-sequences.d.ts +1 -1
- package/dist/types/compute-engine/engine-simplification-rules.d.ts +1 -1
- package/dist/types/compute-engine/engine-startup-coordinator.d.ts +2 -2
- package/dist/types/compute-engine/engine-type-resolver.d.ts +1 -1
- package/dist/types/compute-engine/engine-validation-entrypoints.d.ts +3 -3
- package/dist/types/compute-engine/free-functions.d.ts +4 -4
- package/dist/types/compute-engine/function-properties/index.d.ts +2 -2
- package/dist/types/compute-engine/function-utils.d.ts +2 -2
- package/dist/types/compute-engine/fungrim/loader.d.ts +2 -2
- package/dist/types/compute-engine/fungrim/types.d.ts +2 -2
- package/dist/types/compute-engine/global-types.d.ts +5 -5
- package/dist/types/compute-engine/index.d.ts +30 -30
- package/dist/types/compute-engine/interval/arithmetic.d.ts +2 -2
- package/dist/types/compute-engine/interval/comparison.d.ts +2 -2
- package/dist/types/compute-engine/interval/elementary.d.ts +2 -2
- package/dist/types/compute-engine/interval/index.d.ts +12 -12
- package/dist/types/compute-engine/interval/trigonometric.d.ts +2 -2
- package/dist/types/compute-engine/interval/types.d.ts +1 -1
- package/dist/types/compute-engine/interval/util.d.ts +2 -2
- package/dist/types/compute-engine/latex-syntax/dictionary/default-dictionary.d.ts +17 -17
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-colors.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-complex.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +2 -2
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-relational-operators.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-statistics.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-units.d.ts +2 -2
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +4 -4
- package/dist/types/compute-engine/latex-syntax/dictionary/indexed-types.d.ts +2 -2
- package/dist/types/compute-engine/latex-syntax/latex-syntax.d.ts +3 -3
- package/dist/types/compute-engine/latex-syntax/parse-number.d.ts +3 -3
- package/dist/types/compute-engine/latex-syntax/parse-symbol.d.ts +2 -2
- package/dist/types/compute-engine/latex-syntax/parse.d.ts +5 -5
- package/dist/types/compute-engine/latex-syntax/serialize-dms.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +2 -2
- package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +2 -2
- package/dist/types/compute-engine/latex-syntax/serializer.d.ts +3 -3
- package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/types.d.ts +5 -5
- package/dist/types/compute-engine/latex-syntax/utils.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/library/calculus.d.ts +2 -2
- package/dist/types/compute-engine/library/collections.d.ts +1 -1
- package/dist/types/compute-engine/library/colors.d.ts +1 -1
- package/dist/types/compute-engine/library/combinatorics.d.ts +1 -1
- package/dist/types/compute-engine/library/complex.d.ts +2 -2
- package/dist/types/compute-engine/library/control-structures.d.ts +1 -1
- package/dist/types/compute-engine/library/core.d.ts +1 -1
- package/dist/types/compute-engine/library/distributions.d.ts +1 -1
- package/dist/types/compute-engine/library/fractals.d.ts +1 -1
- package/dist/types/compute-engine/library/library.d.ts +2 -2
- package/dist/types/compute-engine/library/linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/library/logic-analysis.d.ts +1 -1
- package/dist/types/compute-engine/library/logic.d.ts +1 -1
- package/dist/types/compute-engine/library/measurement-arithmetic.d.ts +2 -2
- package/dist/types/compute-engine/library/number-theory.d.ts +1 -1
- package/dist/types/compute-engine/library/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/library/quantity-arithmetic.d.ts +2 -2
- package/dist/types/compute-engine/library/random-expression.d.ts +1 -1
- package/dist/types/compute-engine/library/relational-operator.d.ts +1 -1
- package/dist/types/compute-engine/library/sets.d.ts +2 -2
- package/dist/types/compute-engine/library/special-functions.d.ts +1 -1
- package/dist/types/compute-engine/library/statistics.d.ts +1 -1
- package/dist/types/compute-engine/library/trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/library/type-handlers.d.ts +3 -3
- package/dist/types/compute-engine/library/unit-data.d.ts +2 -2
- package/dist/types/compute-engine/library/units.d.ts +2 -2
- package/dist/types/compute-engine/library/utils.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/big-numeric-value.d.ts +6 -6
- package/dist/types/compute-engine/numeric-value/exact-numeric-value.d.ts +5 -5
- package/dist/types/compute-engine/numeric-value/machine-numeric-value.d.ts +5 -5
- package/dist/types/compute-engine/numeric-value/types.d.ts +4 -4
- package/dist/types/compute-engine/numerics/bernoulli.d.ts +1 -1
- package/dist/types/compute-engine/numerics/bigint.d.ts +1 -1
- package/dist/types/compute-engine/numerics/complex-esm-augment.d.ts +1 -1
- package/dist/types/compute-engine/numerics/differential-equations.d.ts +1 -1
- package/dist/types/compute-engine/numerics/diophantine.d.ts +1 -1
- package/dist/types/compute-engine/numerics/distributions.d.ts +1 -1
- package/dist/types/compute-engine/numerics/expression.d.ts +1 -1
- package/dist/types/compute-engine/numerics/interval.d.ts +1 -1
- package/dist/types/compute-engine/numerics/linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/numerics/monte-carlo.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-complex.d.ts +2 -2
- package/dist/types/compute-engine/numerics/numeric.d.ts +1 -1
- package/dist/types/compute-engine/numerics/oscillatory-quadrature.d.ts +1 -1
- package/dist/types/compute-engine/numerics/polynomial-roots.d.ts +1 -1
- package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
- package/dist/types/compute-engine/numerics/random.d.ts +1 -1
- package/dist/types/compute-engine/numerics/rationals.d.ts +1 -1
- package/dist/types/compute-engine/numerics/richardson.d.ts +1 -1
- package/dist/types/compute-engine/numerics/special-functions.d.ts +2 -2
- package/dist/types/compute-engine/numerics/statistics.d.ts +1 -1
- package/dist/types/compute-engine/numerics/strings.d.ts +2 -2
- package/dist/types/compute-engine/numerics/types.d.ts +1 -1
- package/dist/types/compute-engine/numerics/unit-data.d.ts +1 -1
- package/dist/types/compute-engine/oeis.d.ts +2 -2
- package/dist/types/compute-engine/rubi/compile.d.ts +3 -3
- package/dist/types/compute-engine/rubi/driver.d.ts +3 -3
- package/dist/types/compute-engine/rubi/loader.d.ts +1 -1
- package/dist/types/compute-engine/rubi/match.d.ts +1 -1
- package/dist/types/compute-engine/rubi/normal-form.d.ts +2 -2
- package/dist/types/compute-engine/rubi/rubi-utils.d.ts +3 -3
- package/dist/types/compute-engine/rubi/types.d.ts +1 -1
- package/dist/types/compute-engine/sequence.d.ts +2 -2
- package/dist/types/compute-engine/symbolic/antiderivative.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/derivative.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/differential-equations.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/distribute.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/explain-derivative.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/fu-cost.d.ts +2 -2
- package/dist/types/compute-engine/symbolic/fu-transforms.d.ts +2 -2
- package/dist/types/compute-engine/symbolic/fu.d.ts +6 -6
- package/dist/types/compute-engine/symbolic/limit.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/logic-utils.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/residue.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/series.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-abs.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-divide.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-factorial.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-hyperbolic.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-infinity.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-log.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-logic.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-power.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-product.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-rules.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-sum.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-trig.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/trig-rewrite.d.ts +1 -1
- package/dist/types/compute-engine/tensor/tensor-fields.d.ts +3 -3
- package/dist/types/compute-engine/tensor/tensors.d.ts +1 -1
- package/dist/types/compute-engine/types-definitions.d.ts +6 -6
- package/dist/types/compute-engine/types-engine.d.ts +19 -19
- package/dist/types/compute-engine/types-evaluation.d.ts +5 -5
- package/dist/types/compute-engine/types-expression.d.ts +9 -9
- package/dist/types/compute-engine/types-kernel-evaluation.d.ts +5 -5
- package/dist/types/compute-engine/types-kernel-serialization.d.ts +1 -1
- package/dist/types/compute-engine/types-serialization.d.ts +2 -2
- package/dist/types/compute-engine/types.d.ts +8 -8
- package/dist/types/compute-engine.d.ts +27 -27
- package/dist/types/core.d.ts +12 -12
- package/dist/types/identities.d.ts +3 -3
- package/dist/types/integration-rules.d.ts +3 -3
- package/dist/types/interval.d.ts +8 -8
- package/dist/types/latex-syntax.d.ts +7 -7
- package/dist/types/math-json/symbols.d.ts +1 -1
- package/dist/types/math-json/types.d.ts +1 -1
- package/dist/types/math-json/utils.d.ts +1 -1
- package/dist/types/math-json.d.ts +3 -3
- package/dist/types/numerics.d.ts +23 -23
- package/package.json +2 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Compute Engine 0.69.
|
|
1
|
+
/** Compute Engine 0.69.1 */
|
|
2
2
|
var Us=new Map,jl=1e5;function O(n){if(n<=jl){let e=Us.get(n);return e===void 0&&(e=10n**BigInt(n),Us.set(n,e)),e}return 10n**BigInt(n)}function qe(n){if(n<0n&&(n=-n),n===0n)return 0;let e=0,i=1;for(;n>>BigInt(i)>0n;)i*=2;for(let t=i>>1;t>=1;t>>=1)n>>BigInt(t)>0n&&(e+=t,n>>=BigInt(t));return e+1}function Ys(n,e,i){return n*e>>BigInt(i)}function Ws(n,e,i){return(n<<BigInt(i))/e}function et(n,e){if(n===0n)return 0n;if(n<0n)throw new RangeError("fpsqrt: negative input");let i=n<<BigInt(e),t;if(e<Zl){t=Wt(i);let a;do a=t,t=(t+i/t)/2n;while(Te(t-a)>1n)}else t=Xt(i,qe(i));let r=(t+i/t)/2n,s=Te(t*t-i);return Te(r*r-i)<s?r:t}function Wt(n){let e=qe(n);if(e<=1023){let o=Math.sqrt(Number(n));if(Number.isFinite(o)&&o>=1)return BigInt(Math.floor(o))}let i=e-52,t=Number(n>>BigInt(i)),r=Math.sqrt(t);i&1&&(r*=Math.SQRT2);let s=BigInt(Math.round(r))<<BigInt(i>>1);return s>0n?s:1n}var Xs=1024,Zl=640;function Xt(n,e){if(e<Xs){let s=Wt(n),o;do o=s,s=(s+n/s)/2n;while(Te(s-o)>1n);for(;s*s>n;)s-=1n;for(;(s+1n)*(s+1n)<=n;)s+=1n;return s}let i=e>>2<<1,t=Xt(n>>BigInt(i),e-i)<<BigInt(i>>1),r;do r=t,t=(t+n/t)/2n;while(Te(t-r)>1n);for(;t*t>n;)t-=1n;for(;(t+1n)*(t+1n)<=n;)t+=1n;return t}function Te(n){return n<0n?-n:n}function Rn(n){if(n===0n)return 1;if(n<0n&&(n=-n),n<0x20000000000000n){let t=Number(n);return t<1e8?t<1e4?t<100?t<10?1:2:t<1e3?3:4:t<1e6?t<1e5?5:6:t<1e7?7:8:t<1e12?t<1e10?t<1e9?9:10:t<1e11?11:12:t<1e14?t<1e13?13:14:t<1e15?15:16}let e=n.toString(16).length*4,i=Math.ceil(e*.30102999566398);for(;n<O(i-1);)i--;for(;n>=O(i);)i++;return i}var Ul=.7;function Kt(n,e){if(n===0n)return 1n<<BigInt(e);let i=Math.round(Ul*Math.sqrt(e)),t=i+8,r=e+t,s=BigInt(r),o=1n<<s,a=BigInt(t),u=n<<a,l=u<0n,c=l?-u:u,f=Math.max(0,qe(c)-r+i);c>>=BigInt(f),u=l?-c:c;let p=o,g=u;p+=g;for(let y=2;g=(g*u>>s)/BigInt(y),g!==0n;y++)p+=g;for(let y=0;y<f;y++)p=p*p>>s;return p+(1n<<a-1n)>>a}var Hl=4e4;function Qt(n,e){let i=1n<<BigInt(e);if(n<=0n)throw new RangeError("fpln: input must be positive");return n===i?0n:e>=Hl?Xl(n,e):Yl(n,e)}function Yl(n,e){let i=BigInt(e),t=1n<<i,r=52,s=e-r,o;if(s>0){let y=Number(n>>BigInt(s))/2**r;o=BigInt(Math.round(Math.log(y)*2**r))<<BigInt(s)}else{let y=Number(n)/Number(t);o=BigInt(Math.round(Math.log(y)*Number(t)))}let a=n*Kt(-o,e)>>i,l=(a-t<<i)/(a+t),c=l<0n?-l:l,f=c*c>>i,p=c,g=c;for(let y=3n;p=p*f>>i,p!==0n;y+=2n)g+=p/y;return o+(l<0n?-2n:2n)*g}var hn=null;function Wl(n){if(hn!==null){if(hn.bits===n)return hn.value;if(hn.bits>n)return hn.value>>BigInt(hn.bits-n)}let e=Math.ceil(n*nt)+12,i;if(e<=Hs.length){let t=Hs.slice(0,e);i=(BigInt(t)<<BigInt(n))/O(t.length)}else i=tc(n);return hn={bits:n,value:i},i}function Xl(n,e){let i=BigInt(e),t=qe(n)-e,r=Math.max(2,Math.ceil(e/2+4-t)),s=n<<BigInt(r-2),o=1n<<i,a=s;for(;Te(o-a)>1n;){let l=o+a>>1n;a=mi(o*a),o=l}return Qi(e)*s/(2n*o)-BigInt(r)*Wl(e)}var _n="314159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316527120190914564856692346034861045432664821339360726024914127372458700660631558817488152092096282925409171536436789259036001133053054882046652138414695194151160943305727036575959195309218611738193261179310511854807446237996274956735188575272489122793818301194912983367336244065664308602139494639522473719070217986094370277053921717629317675238467481846766940513200056812714526356082778577134275778960917363717872146844090122495343014654958537105079227968925892354201995611212902196086403441815981362977477130996051870721134999999837297804995105973173281609631859502445945534690830264252230825334468503526193118817101000313783875288658753320838142061717766914730359825349042875546873115956286388235378759375195778185778053217122680661300192787661119590921642019893809525720106548586327886593615338182796823030195203530185296899577362259941389124972177528347913151557485724245415069595082953311686172785588907509838175463746493931925506040092770167113900984882401285836160356370766010471018194295559619894676783744944825537977472684710404753464620804668425906949129331367702898915210475216205696602405803815019351125338243003558764024749647326391419927260426992279678235478163600934172164121992458631503028618297455570674983850549458858692699569092721079750930295532116534498720275596023648066549911988183479775356636980742654252786255181841757467289097777279380008164706001614524919217321721477235014144197356854816136115735255213347574184946843852332390739414333454776241686251898356948556209921922218427255025425688767179049460165346680498862723279178608578438382796797668145410095388378636095068006422512520511739298489608412848862694560424196528502221066118630674427862203919494504712371378696095636437191728746776465757396241389086583264599581339047802759009946576407895126946839835259570982582262052248940772671947826848260147699090264013639443745530506820349625245174939965143142980919065925093722169646151570985838741059788595977297549893016175392846813826868386894277415599185592524595395943104997252468084598727364469584865383673622262609912460805124388439045124413654976278079771569143599770012961608944169486855584840635",nt=Math.log10(2),Hs="693147180559945309417232121458176568075500134360255254120680009493393621969694715605863326996418687542001481020570685733685520235758130557032670751635075961930727570828371435190307038623891673471123350115364497955239120475172681574932065155524734139525882950453007095326366642654104239157814952043740430385500801944170641671518644712839968171784546957026271631064546150257207402481637773389638550695260668341137273873722928956493547025762652098859693201965058554764703306793654432547632744951250406069438147104689946506220167720424524529612687946546193165174681392672504103802546259656869144192871608293803172714367782654877566485085674077648451464439940461422603193096735402574446070308096085047486638523138181676751438667476647890881437141985494231519973548803751658612753529166100071053558249879414729509293113897155998205654392871700072180857610252368892132449713893203784393530887748259701715591070882368362758984258918535302436342143670611892367891923723146723217205340164925687274778234453534764811494186423867767744060695626573796008670762571991847340226514628379048830620330611446300737194890027436439650025809365194430411911506080948793067865158870900605203468429736193841289652556539686022194122924207574321757489097706752687115817051137009158942665478595964890653058460258668382940022833005382074005677053046787001841624044188332327983863490015631218895606505531512721993983320307514084260914790012651682434438935724727882054862715527418772430024897945401961872339808608316648114909306675193393128904316413706813977764981769748689038877899912965036192707108892641052309247839173735012298424204995689359922066022046549415106139187885744245577510206837030866619480896412186807790208181588580001688115973056186676199187395200766719214592236720602539595436541655311295175989940056000366513567569051245926825743946483168332624901803824240824231452306140963805700702551387702681785163069025513703234053802145019015374029509942262995779647427138157363801729873940704242179972266962979939312706935747240493386530879758721699645129446491883771156701678598804981838896784134938314014073166472765327635919233511233389338709513209059272185471328975470797891384445466676192702885533423429899321803769154973340267546758873236778342916191810430116091695265547859732891763545556742863877463987101912431754255888301206779210280341206879759143081283307230300883494705792496591005860012341561757413272465943",Kl=13591409n,Ql=545140134n,ec=10939058860032000n,nc=47.11;function Ki(n,e){if(e-n===1){let l,c;if(n===0)l=1n,c=1n;else{l=BigInt(6*n-5)*BigInt(2*n-1)*BigInt(6*n-1);let p=BigInt(n);c=p*p*p*ec}let f=l*(Kl+Ql*BigInt(n));return n&1&&(f=-f),[l,c,f]}let i=n+e>>1,[t,r,s]=Ki(n,i),[o,a,u]=Ki(i,e);return[t*o,r*a,a*s+t*u]}function Ks(n){return Math.max(2,Math.floor(n/nc)+3)}function ic(n){let[,e,i]=Ki(0,Ks(n)),t=1n<<BigInt(n),r=mi(10005n*t*t);return e*426880n*r/i}function Qs(n){let[,e,i]=Ki(0,Ks(Math.ceil(n/nt))),t=O(n),r=mi(10005n*t*t);return e*426880n*r/i}function Yt(n,e){if(e-n===1){let l=n===0?1n:BigInt(2*n-1),c=n===0?1n:9n*BigInt(2*n+1);return[l,c,l]}let i=n+e>>1,[t,r,s]=Yt(n,i),[o,a,u]=Yt(i,e);return[t*o,r*a,a*s+t*u]}function tc(n){let e=Math.max(2,Math.ceil(n/3.169925)+5),[,i,t]=Yt(0,e);return(t<<BigInt(n+1))/(3n*i)}function mi(n){if(n<0n)throw new RangeError("bigintSqrt: negative input");if(n===0n)return 0n;let e=qe(n);if(e>=Xs)return Xt(n,e);let i=Wt(n),t;do t=i,i=(i+n/i)/2n;while(Te(i-t)>1n);for(;i*i>n;)i-=1n;for(;(i+1n)*(i+1n)<=n;)i+=1n;return i}var xn=null;function Qi(n){if(xn!==null){if(xn.bits===n)return xn.value;if(xn.bits>n)return xn.value>>BigInt(xn.bits-n)}let e=rc(n);return xn={bits:n,value:e},e}function rc(n){let e=Math.ceil(n*nt)+12;if(e+1<=_n.length){let i=_n.slice(0,e+1);return(BigInt(i)<<BigInt(n))/O(i.length-1)}return ic(n)}function it(n,e){let i=BigInt(e),t=1n<<i;if(n===0n)return[0n,t];let r=Qi(e),s=2n*r,o=r/2n,a,u=Te(n);if(u>t<<30n){let V=qe(u)-e+64,he=e+V,oe=n<<BigInt(V),Xi=2n*Qi(he),fi=oe%Xi;fi<0n&&(fi+=Xi),a=fi>>BigInt(V)}else a=n%s;a<0n&&(a+=s);let l=1n,c=1n;a>3n*o?(a=s-a,l=-1n):a>r?(a=a-r,l=-1n,c=-1n):a>o&&(a=r-a,c=-1n);let f=Math.round(e*nt),p=Math.min(18,Math.max(2,Math.ceil(.87*Math.sqrt(f)))),g=0,y=t>>BigInt(p);for(;a>y;)a=a/2n,g++;let b=a,S=t,k=a,M=t,C=a*a,q=2n*i;for(let V=2;;V+=2){if(M=(M*C>>q)/(BigInt(V)*BigInt(V-1)),M===0n){k=(k*C>>q)/(BigInt(V+1)*BigInt(V)),k!==0n&&(V%4===2?(S-=M,b-=k):(S+=M,b+=k));break}if(k=(k*C>>q)/(BigInt(V+1)*BigInt(V)),V%4===2?(S-=M,b-=k):(S+=M,b+=k),k===0n)break}for(let V=0;V<g;V++){let he=2n*b*S>>i,oe=(2n*S*S>>i)-t;b=he,S=oe}return[l*b,c*S]}function pi(n,e){if(n===0n)return 0n;if(n<0n)return-pi(-n,e);let i=BigInt(e),t=1n<<i,s=Qi(e)/2n;if(n>t){let g=(t<<i)/n;return s-pi(g,e)}let o=4n*t/10n,a=0,u=n;for(;u>o;){let g=u*u,y=(t<<i)+g>>i,b=et(y,e);u=(u<<i)/(t+b),a++}let l=u,c=u,f=u*u,p=2n*i;for(let g=3;c=c*f>>p,c!==0n;g+=2)g%4===3?l-=c/BigInt(g):l+=c/BigInt(g);for(let g=0;g<a;g++)l=2n*l;return l}var er=NaN,m=class n{static precision=50;static ZERO=Object.freeze(Object.assign(Object.create(n.prototype),{_digits:1,significand:0n,exponent:0}));static ONE=Object.freeze(Object.assign(Object.create(n.prototype),{_digits:1,significand:1n,exponent:0}));static TWO=Object.freeze(Object.assign(Object.create(n.prototype),{_digits:1,significand:2n,exponent:0}));static NEGATIVE_ONE=Object.freeze(Object.assign(Object.create(n.prototype),{_digits:1,significand:-1n,exponent:0}));static HALF=Object.freeze(Object.assign(Object.create(n.prototype),{_digits:1,significand:5n,exponent:-1}));static NAN=Object.freeze(Object.assign(Object.create(n.prototype),{_digits:1,significand:0n,exponent:NaN}));static POSITIVE_INFINITY=Object.freeze(Object.assign(Object.create(n.prototype),{_digits:1,significand:1n,exponent:1/0}));static NEGATIVE_INFINITY=Object.freeze(Object.assign(Object.create(n.prototype),{_digits:1,significand:-1n,exponent:1/0}));static _piFullPrecision=null;static _piCache=null;static _piCachePrecision=0;static _eulerGammaCache=null;static _eulerGammaCachePrecision=0;static get PI(){let e=n.precision;if(n._piCache!==null&&n._piCachePrecision===e)return n._piCache;let i=e+4,t;if(i+1<=_n.length)n._piFullPrecision===null&&(n._piFullPrecision=new n(_n[0]+"."+_n.slice(1))),t=n._piFullPrecision.toPrecision(i);else{let r=i+4;t=F(Qs(r),-r).toPrecision(i)}return n._piCache=t,n._piCachePrecision=e,t}static get EULER_GAMMA(){let e=n.precision;if(n._eulerGammaCache!==null&&n._eulerGammaCachePrecision>=e)return n._eulerGammaCache.toPrecision(e);let i=ac(e);return n._eulerGammaCache=i,n._eulerGammaCachePrecision=e,i}significand;exponent;_digits;digitCount(){return this._digits??(this._digits=Rn(this.significand))}constructor(e){if(e instanceof n){this.significand=e.significand,this.exponent=e.exponent;return}if(typeof e=="bigint"){[this.significand,this.exponent]=tt(e,0);return}if(typeof e=="number"){[this.significand,this.exponent]=uc(e);return}[this.significand,this.exponent]=ro(e)}isNaN(){return Number.isNaN(this.exponent)}isZero(){return this.exponent===0&&this.significand===0n}isFinite(){return Number.isFinite(this.exponent)}isInteger(){return this.isFinite()&&this.exponent>=0}isPositive(){return this.significand>0n}isNegative(){return this.significand<0n}cmp(e){if(typeof e=="number"){if(Number.isNaN(e))return er;let g=this.exponent;if(Number.isNaN(g))return er;if(e===0)return this.significand===0n?0:this.significand>0n?1:-1;if(!Number.isFinite(g))return e===1/0?this.significand>0n?0:-1:e===-1/0?this.significand<0n?0:1:this.significand>0n?1:-1;if(this.significand===0n)return e>0?-1:1;if(e===1/0)return-1;if(e===-1/0)return 1;if(this.significand>0n!=e>0)return this.significand>0n?1:-1;if(Number.isInteger(e)&&g>=0&&g<=15){let y=this.significand*O(g),b=BigInt(e);return y<b?-1:y>b?1:0}e=new n(e)}let i=this.exponent,t=e.exponent,r=this.significand,s=e.significand;if(i!==i||t!==t)return er;if(!Number.isFinite(i)||!Number.isFinite(t))return!Number.isFinite(i)&&!Number.isFinite(t)?r===s?0:r>s?1:-1:Number.isFinite(i)?s>0n?-1:1:r>0n?1:-1;if(r===0n)return s===0n?0:s>0n?-1:1;if(s===0n)return r>0n?1:-1;if(r>0n&&s<0n)return 1;if(r<0n&&s>0n)return-1;if(i===t)return r<s?-1:r>s?1:0;let o=this.digitCount(),a=e.digitCount(),u=o+i,l=a+t;if(u!==l){let g=r>0n?1:-1;return u>l?g:-g}let c=r,f=s,p=Math.abs(i-t);if(p>1e3){let g=o,y=a,b=Math.max(g,y)+1;g<b&&(c=c*O(b-g)),y<b&&(f=f*O(b-y))}else i<t?f=f*O(p):c=c*O(p);return c<f?-1:c>f?1:0}eq(e){return typeof e=="number"?e===0?this.significand===0n&&this.exponent===0:e===1?this.significand===1n&&this.exponent===0:e===-1?this.significand===-1n&&this.exponent===0:Number.isInteger(e)&&Number.isFinite(this.exponent)&&this.exponent>=0&&this.exponent<=15?this.significand*O(this.exponent)===BigInt(e):this.cmp(e)===0:this.significand===e.significand&&this.exponent===e.exponent}lt(e){return this.cmp(e)===-1}lte(e){let i=this.cmp(e);return i===-1||i===0}gt(e){return this.cmp(e)===1}gte(e){let i=this.cmp(e);return i===1||i===0}add(e){typeof e=="number"&&(e=new n(e));let i=this.exponent,t=e.exponent;if(Number.isFinite(i)&&Number.isFinite(t)){if(i===t)return F(this.significand+e.significand,i);let o=i-t;return o>0?F(this.significand*O(o)+e.significand,t):F(this.significand+e.significand*O(-o),i)}if(i!==i||t!==t)return n.NAN;let r=!Number.isFinite(i),s=!Number.isFinite(t);return r&&s?this.significand!==e.significand?n.NAN:this.significand>0n?n.POSITIVE_INFINITY:n.NEGATIVE_INFINITY:r?this.significand>0n?n.POSITIVE_INFINITY:n.NEGATIVE_INFINITY:e.significand>0n?n.POSITIVE_INFINITY:n.NEGATIVE_INFINITY}sub(e){typeof e=="number"&&(e=new n(e));let i=this.exponent,t=e.exponent;if(Number.isFinite(i)&&Number.isFinite(t)){if(i===t)return F(this.significand-e.significand,i);let o=i-t;return o>0?F(this.significand*O(o)-e.significand,t):F(this.significand-e.significand*O(-o),i)}if(i!==i||t!==t)return n.NAN;let r=!Number.isFinite(i),s=!Number.isFinite(t);return r&&s?this.significand===e.significand?n.NAN:this.significand>0n?n.POSITIVE_INFINITY:n.NEGATIVE_INFINITY:r?this.significand>0n?n.POSITIVE_INFINITY:n.NEGATIVE_INFINITY:e.significand>0n?n.NEGATIVE_INFINITY:n.POSITIVE_INFINITY}mul(e){typeof e=="number"&&(e=new n(e));let i=this.exponent,t=e.exponent;if(Number.isFinite(i)&&Number.isFinite(t))return F(this.significand*e.significand,i+t);if(i!==i||t!==t||this.significand===0n||e.significand===0n)return n.NAN;let r=this.significand>0n?1n:-1n,s=e.significand>0n?1n:-1n;return r*s>0n?n.POSITIVE_INFINITY:n.NEGATIVE_INFINITY}mulToPrecision(e,i){typeof e=="number"&&(e=new n(e));let t=this.exponent,r=e.exponent,s=this.significand,o=e.significand;if(s!==0n&&o!==0n&&Number.isFinite(t)&&Number.isFinite(r)){let a=s*o,u=t+r,l=this.digitCount()+e.digitCount()-1,f=(a<0n?-a:a)>=O(l)?l+1:l;return f<=i?F(a,u):eo(a,u).roundToPrecKnownDigits(i,f)}return this.mul(e).toPrecision(i)}neg(){let e=this.significand;return e===0n?this:Number.isFinite(this.exponent)?F(-e,this.exponent):e>0n?n.NEGATIVE_INFINITY:n.POSITIVE_INFINITY}abs(){return this.significand>=0n?this:Number.isFinite(this.exponent)?F(-this.significand,this.exponent):n.POSITIVE_INFINITY}floor(){let e=this.exponent;if(e>=0)return this;if(Number.isFinite(e)){let i=this.trunc();return this.significand<0n?i.sub(F(1n,0)):i}return this}ceil(){let e=this.exponent;if(e>=0)return this;if(Number.isFinite(e)){let i=this.trunc();return this.significand>0n?i.add(F(1n,0)):i}return this}round(){let e=this.exponent;if(e>=0)return this;if(Number.isFinite(e)){let i=F(5n,-1);return this.significand>0n?this.add(i).trunc():this.sub(i).trunc()}return this}trunc(){let e=this.exponent;if(e>=0)return this;if(Number.isFinite(e)){let i=this.significand/O(-e);return F(i===0n?0n:i,0)}return this}div(e){typeof e=="number"&&(e=new n(e));let i=this.exponent,t=e.exponent,r=this.significand,s=e.significand;if(Number.isFinite(i)&&Number.isFinite(t)){if(s===0n)return r===0n?n.NAN:r>0n?n.POSITIVE_INFINITY:n.NEGATIVE_INFINITY;if(r===0n)return F(0n,0);let u=n.precision,l=10,c=this.digitCount(),f=e.digitCount(),p=u+l+Math.max(0,f-c),g=O(p),y=r*g/s,b=i-t-p,S=y<0n?-y:y,k=c+p-f,M=S>=O(k)?k+1:k;return eo(y,b).roundToPrecKnownDigits(u,M)}if(i!==i||t!==t)return n.NAN;let o=!Number.isFinite(i),a=!Number.isFinite(t);if(o&&a)return n.NAN;if(o){let u=r>0n?1n:-1n,l=s>0n?1n:s<0n?-1n:1n;return u*l>0n?n.POSITIVE_INFINITY:n.NEGATIVE_INFINITY}return F(0n,0)}inv(){return F(1n,0).div(this)}divToward(e,i){typeof e=="number"&&(e=new n(e));let t=this.exponent,r=e.exponent,s=this.significand,o=e.significand;if(!Number.isFinite(t)||!Number.isFinite(r)||o===0n||s===0n)return this.div(e);let a=s<0n!=o<0n,u=s<0n?-s:s,l=o<0n?-o:o,c=n.precision,p=c+10+Math.max(0,e.digitCount()-this.digitCount()),g=u*O(p),y=g/l,b=g%l!==0n,S=t-r-p,k=this.digitCount()+p-e.digitCount(),M=y>=O(k)?k+1:k,C=a?i==="floor":i==="ceiling",[q,V]=no(y,b,S,c,C,M);return F(a?-q:q,V)}sqrtToward(e){if(this.significand===0n)return this.exponent!==this.exponent?this:n.ZERO;if(!Number.isFinite(this.exponent))return this.significand>0n?n.POSITIVE_INFINITY:n.NAN;if(this.significand<0n)return n.NAN;let i=n.precision,t=4,r=this.significand,s=this.exponent,o=s+this.digitCount()-1,a=Math.floor(o/2),u=i+t-a;s+2*u<0&&(u=Math.ceil(-s/2)+1);let l=s+2*u,c=l>=0?r*O(l):r/O(-l),f=mi(c),p=f*f!==c,[g,y]=no(f,p,-u,i,e==="ceiling");return F(g,y)}mod(e){typeof e=="number"&&(e=new n(e));let i=this.exponent,t=e.exponent;if(Number.isFinite(i)&&Number.isFinite(t)){if(e.significand===0n)return n.NAN;if(this.significand===0n)return F(0n,0);let r=i-t,s=r>=0?this.significand*O(r):this.significand,o=r>=0?e.significand:e.significand*O(-r),a=s/o;return this.sub(F(a,0).mul(e))}return i!==i||t!==t||!Number.isFinite(i)?n.NAN:new n(this)}pow(e){if(typeof e=="number"&&(e=new n(e)),this.isNaN()||e.isNaN()||!e.isFinite())return n.NAN;if(e.isInteger()){let a=e.toBigInt();if(a===0n)return F(1n,0);if(!this.isFinite())return a>0n?this.significand<0n&&a%2n!==0n?n.NEGATIVE_INFINITY:n.POSITIVE_INFINITY:F(0n,0);if(this.isZero())return a>0n?F(0n,0):n.POSITIVE_INFINITY;if(a<0n)return this.pow(e.neg()).inv();let u=this.significand<0n?-this.significand:this.significand,l=this.digitCount(),c=l>15?l-15:0,f=c>0?Number(u/10n**BigInt(c)):Number(u),p=Math.log10(f)+c+this.exponent,g=Number(a)*p;if(g>9e15)return this.significand<0n&&a%2n!==0n?n.NEGATIVE_INFINITY:n.POSITIVE_INFINITY;if(g<-9e15)return F(0n,0);let y=n.precision,b=a.toString(2).length,S=Math.min(2*b+5,100),k=y+S,M=F(1n,0),C=this,q=a;for(;q>0n;)q&1n&&(M=M.mulToPrecision(C,k)),q>>=1n,q>0n&&(C=C.mulToPrecision(C,k));return M.toPrecision(y)}if(!this.isFinite())return this.significand<0n?n.NAN:e.significand>0n?n.POSITIVE_INFINITY:n.ZERO;if(this.isZero())return e.significand>0n?n.ZERO:n.POSITIVE_INFINITY;if(this.significand<0n)return n.NAN;let i=this.exponent+this.digitCount()-1,r=e.exponent+e.digitCount()-1+Math.log10(Math.abs(i)*2.303+3)+1,s=Math.min(20,Math.max(2,Math.ceil(r)+2)),o=n.precision;n.precision=o+s;try{let a=oc(this,o+s);return e.mul(a).exp().toPrecision(o)}finally{n.precision=o}}toNumber(){return Number.isFinite(this.exponent)?this.significand===0n?0:this.exponent===0?Number(this.significand):Number(this.toString()):this.exponent!==this.exponent?NaN:this.significand>0n?1/0:-1/0}toString(){if(!Number.isFinite(this.exponent))return this.exponent!==this.exponent?"NaN":this.significand>0n?"Infinity":"-Infinity";if(this.significand===0n)return"0";let e=this.significand<0n,i=(e?-this.significand:this.significand).toString(),t=i.length,r=t+this.exponent-1,s=e?"-":"";if(r>20||r<-6){let u=t===1?i:i[0]+"."+i.slice(1),l=r>=0?"+":"";return`${s}${u}e${l}${r}`}if(this.exponent>=0)return s+i+"0".repeat(this.exponent);let o=-this.exponent;if(o<t){let u=i.slice(0,t-o),l=i.slice(t-o);return`${s}${u}.${l}`}let a=o-t;return`${s}0.${"0".repeat(a)}${i}`}toFixed(e){let i=e??0;if(!Number.isFinite(this.exponent))return this.exponent!==this.exponent?"NaN":this.significand>0n?"Infinity":"-Infinity";let t=this.significand<0n,r=t?-this.significand:this.significand,s=this.exponent+i,o,a;if(s>=0)a=r===0n,o=a?"0":r.toString()+"0".repeat(s);else{let f=O(-s),p=r/f,g=r%f,y=f/2n,b;g>y?b=p+1n:g<y||f%2n!==0n||p%2n===0n?b=p:b=p+1n,a=b===0n,o=b.toString()}let u=t&&!a?"-":"";if(i===0)return`${u}${o}`;if(o.length<=i){let f=o.padStart(i,"0");return`${u}0.${f}`}let l=o.slice(0,o.length-i),c=o.slice(o.length-i);return`${u}${l}.${c}`}toPrecision(e){if(this.significand===0n||!Number.isFinite(this.exponent))return this;let i=this.digitCount();return i<=e?this:this.roundToPrecKnownDigits(e,i)}roundToPrecKnownDigits(e,i){let t=this.significand<0n?-this.significand:this.significand,r=i-e,s=O(r),o=t/s,a=t-o*s,u=s/2n;(a>u||a===u&&o%2n!==0n)&&(o+=1n);let l=this.significand<0n?-o:o;return F(l,this.exponent+r)}toBigInt(){if(!Number.isFinite(this.exponent))throw this.exponent!==this.exponent?new RangeError("Cannot convert NaN to BigInt"):new RangeError("Cannot convert Infinity to BigInt");if(this.exponent>=0)return this.significand*O(this.exponent);let e=O(-this.exponent);return this.significand/e}},sc=8,di=[];function oc(n,e){let i=n.significand,t=n.exponent;for(let s=di.length-1;s>=0;s--){let o=di[s];if(o.prec===e&&o.exp===t&&o.sig===i)return o.ln}let r=n.ln();return di.push({sig:i,exp:t,prec:e,ln:r}),di.length>sc&&di.shift(),r}function ac(n){let e=n+20+Math.ceil(Math.log10(n+10)),i=m.precision;m.precision=e;try{let t=Math.ceil(e*Math.LN10/4)+5,r=new m(t),s=r.mul(r),o=m.ONE,a=m.ONE,u=m.ZERO,l=m.ZERO,c=m.ONE.div(new m(10).pow(e)),f=6*t+100;for(let p=1;p<=f;p++){let g=new m(p).mul(p);if(o=o.mul(s).div(g).toPrecision(e),l=l.add(m.ONE.div(p)).toPrecision(e),a=a.add(o).toPrecision(e),u=u.add(o.mul(l)).toPrecision(e),p>t&&o.lt(a.mul(c)))break}return u.div(a).sub(r.ln()).toPrecision(n)}finally{m.precision=i}}function F(n,e){let[i,t]=tt(n,e),r=Object.create(m.prototype);return r.significand=i,r.exponent=t,r}function eo(n,e){let i=Object.create(m.prototype);return i.significand=n,i.exponent=e,i}function no(n,e,i,t,r,s){if(n===0n)return[r&&e?1n:0n,i];let o=s??Rn(n);if(o<=t)return[r&&e?n+1n:n,i];let a=o-t,u=O(a),l=n/u,c=e||n%u!==0n;return r&&c&&(l+=1n),[l,i+a]}var io=1000000000n,to=1000n;function tt(n,e){if(n===0n)return[0n,0];if((n&1n)!==0n)return[n,e];if(n%10n!==0n)return[n,e];for(;n%io===0n;)n/=io,e+=9;for(;n%to===0n;)n/=to,e+=3;for(;n%10n===0n;)n/=10n,e+=1;return[n,e]}function uc(n){return Number.isNaN(n)?[0n,NaN]:n===1/0?[1n,1/0]:n===-1/0?[-1n,1/0]:Number.isInteger(n)?tt(BigInt(n),0):ro(n.toString())}function ro(n){if(n=n.trim(),n===""||n==="NaN")return[0n,NaN];if(n==="Infinity"||n==="+Infinity")return[1n,1/0];if(n==="-Infinity")return[-1n,1/0];let e,i=0,t=n.search(/[eE]/);if(t!==-1){if(e=n.slice(0,t),i=Number(n.slice(t+1)),!Number.isFinite(i))return[0n,NaN]}else e=n;let r=!1;e.startsWith("-")?(r=!0,e=e.slice(1)):e.startsWith("+")&&(e=e.slice(1));let s=e.indexOf("."),o,a;s===-1?(o=e,a=""):(o=e.slice(0,s),a=e.slice(s+1)),o=o.replace(/^0+/,"")||"0";let u=o+a;if(u.length===0||!/^\d+$/.test(u))return[0n,NaN];let l=BigInt(u);r&&(l=-l);let c=-a.length;return tt(l,c+i)}var lc=Math.log2(10),ao=Math.log10(2),cc=16,ir=1e6;function ze(n,e){let i=Math.ceil(e*lc)+cc,t=BigInt(i);return n.exponent>=0?[n.significand*O(n.exponent)<<t,i]:[(n.significand<<t)/O(-n.exponent),i]}function Ge(n,e,i){if(n===0n)return m.ZERO;let t=n<0n,r=t?-n:n,s=BigInt(e),o=qe(r)-e,a=Math.floor(o*ao),u=i+4-a,l,c;if(u>=0)l=r*O(u)+(1n<<s-1n)>>s,c=-u;else{let p=O(-u)<<s;l=(r+p/2n)/p,c=-u}if(l===0n)return m.ZERO;let f=Rn(l);if(f>i){let p=f-i,g=O(p),y=g/2n,b=l%g;l=l/g,b>=y&&(l+=1n),c+=p}return F(t?-l:l,c)}function ae(n){return n.exponent+n.digitCount()-1}function nr(n,e){if(n===0n)return 0;let i=n<0n?-n:n,t=e*ao-(Rn(i)-1);return t>0?Math.ceil(t):0}var uo=5,so=BigInt(Number.MAX_SAFE_INTEGER),yn=null;function lo(n){if(yn!==null){if(yn.bits===n)return yn.value;if(yn.bits>n)return yn.value>>BigInt(yn.bits-n)}let e=Qt(10n<<BigInt(n),n);return yn={bits:n,value:e},e}m.prototype.sqrt=function(){if(this.isNaN())return m.NAN;if(this.isZero())return m.ZERO;if(!this.isFinite())return this.significand>0n?m.POSITIVE_INFINITY:m.NAN;if(this.significand<0n)return m.NAN;let n=m.precision,e=n+10,i=ae(this),t=Math.floor(i/2),r=F(this.significand,this.exponent-2*t),[s,o]=ze(r,e),a=et(s,o),u=Ge(a,o,n);return F(u.significand,u.exponent+t)};m.prototype.cbrt=function(){if(this.isNaN())return m.NAN;if(this.isZero())return m.ZERO;if(!this.isFinite())return this.significand>0n?m.POSITIVE_INFINITY:m.NEGATIVE_INFINITY;if(this.significand<0n)return this.neg().cbrt().neg();let n=m.precision,e=n+10,i=ae(this),t=Math.floor(i/3),r=F(this.significand,this.exponent-3*t),[s,o]=ze(r,e),a=s<<BigInt(2*o),u,l=r.toNumber();if(o<=1e3&&Number.isFinite(l)&&l>0){let p=Number(1n<<BigInt(o)),g=Math.cbrt(l);Number.isFinite(g)&&g>0?(u=BigInt(Math.floor(g*p)),u===0n&&(u=1n)):u=oo(a)}else u=oo(a);let c;do{c=u;let p=u*u;if(p===0n){u=1n;break}u=(2n*u+a/p)/3n}while(Te(u-c)>1n);{let p=(2n*u+a/(u*u))/3n,g=Te(u*u*u-a);Te(p*p*p-a)<g&&(u=p)}let f=Ge(u,o,n);return F(f.significand,f.exponent+t)};m.sqrt=function(n){return n.sqrt()};m.cbrt=function(n){return n.cbrt()};m.prototype.exp=function(){if(this.isNaN())return m.NAN;if(!this.isFinite())return this.significand>0n?m.POSITIVE_INFINITY:m.ZERO;if(this.isZero())return m.ONE;if(ae(this)>=17)return this.significand>0n?m.POSITIVE_INFINITY:m.ZERO;let n=m.precision,e=Math.max(0,this.exponent+this.digitCount()),i=n+20+e,[t,r]=ze(this,i),s=lo(r),o=t/s,a=t-o*s;if(a<0n&&(o-=1n,a+=s),o>so||o<-so)return o>0n?m.POSITIVE_INFINITY:m.ZERO;let u=Ge(Kt(a,r),r,n),l=u.exponent+Number(o);return Number.isSafeInteger(l)?F(u.significand,l):o>0n?m.POSITIVE_INFINITY:m.ZERO};m.prototype.ln=function(){if(this.isNaN())return m.NAN;if(!this.isFinite())return this.significand>0n?m.POSITIVE_INFINITY:m.NAN;if(this.isZero())return m.NEGATIVE_INFINITY;if(this.significand<0n)return m.NAN;if(this.eq(1))return m.ZERO;let n=m.precision,e=this.significand,i=this.digitCount(),t=this.exponent+i-1,r=F(e,-(i-1)),s=Math.abs(t).toString().length,o=0;if(t===0||t===-1){let p=this.sub(m.ONE);if(!p.isZero()){let g=ae(p);g<0&&(o=-g)}}let a=n+20+s+o,[u,l]=ze(r,a),c=lo(l),f=Qt(u,l)+BigInt(t)*c;return Ge(f,l,n)};m.prototype.log=function(n){let e=n instanceof m?n:new m(n),i=m.precision;m.precision=i+10;try{return this.ln().div(e.ln()).toPrecision(i)}finally{m.precision=i}};m.exp=function(n){return n.exp()};m.ln=function(n){return n.ln()};m.log10=function(n){return n.log(10)};m.log2=function(n){return n.log(2)};m.prototype.sin=function(){if(this.isNaN())return m.NAN;if(!this.isFinite())return m.NAN;if(this.isZero())return m.ZERO;let n=m.precision,e=ae(this);if(e<0&&-2*e>=n+4)return this.toPrecision(n);let i=n+15+(e<0?-e:0);if(e+i+30>ir)return m.NAN;let[t,r]=ze(this,i),[s]=it(t,r);return Ge(s,r,n)};m.prototype.cos=function(){if(this.isNaN())return m.NAN;if(!this.isFinite())return m.NAN;if(this.isZero())return m.ONE;let n=m.precision,e=ae(this),i=0;for(let t=0;;t++){let r=n+15+i;if(e+r+30>ir)return m.NAN;let[s,o]=ze(this,r),[,a]=it(s,o);if(a===0n){if(t>=3)return m.ZERO;i+=n+30;continue}let u=nr(a,o);if(u<=i+uo||t>=3)return Ge(a,o,n);i=u+5}};m.prototype.tan=function(){if(this.isNaN())return m.NAN;if(!this.isFinite())return m.NAN;if(this.isZero())return m.ZERO;let n=m.precision,e=ae(this);if(e<0&&-2*e>=n+4)return this.toPrecision(n);let i=e<0?-e:0,t=0;for(let r=0;;r++){let s=n+15+i+t;if(e+s+30>ir)return m.NAN;let[o,a]=ze(this,s),[u,l]=it(o,a);if(l===0n){if(r>=3)return u>0n?m.POSITIVE_INFINITY:m.NEGATIVE_INFINITY;t+=n+30;continue}let c=Math.max(u===0n?0:nr(u,a),nr(l,a));if(c<=t+uo||r>=3){let f=(u<<BigInt(a))/l;return Ge(f,a,n)}t=c+5}};m.prototype.atan=function(){if(this.isNaN())return m.NAN;if(this.isZero())return m.ZERO;if(!this.isFinite()){let o=m.PI.div(m.TWO);return this.significand>0n?o:o.neg()}let n=m.precision,e=ae(this);if(e<0&&-2*e>=n+4)return this.toPrecision(n);let i=n+15+(e<0?-e:0),[t,r]=ze(this,i),s=pi(t,r);return Ge(s,r,n)};m.prototype.asin=function(){if(this.isNaN())return m.NAN;if(!this.isFinite())return m.NAN;if(this.isZero())return m.ZERO;let n=this.abs(),e=m.ONE;if(n.gt(e))return m.NAN;if(n.eq(e)){let g=m.PI.div(m.TWO);return this.significand>0n?g:g.neg()}let i=m.precision,t=ae(this);if(t<0&&-2*t>=i+4)return this.toPrecision(i);let r=i+20+(t<0?-t:0),[s,o]=ze(this,r),a=1n<<BigInt(o),u=Ys(s,s,o),l=a-u,c=et(l,o),f=Ws(s,c,o),p=pi(f,o);return Ge(p,o,i)};m.prototype.acos=function(){if(this.isNaN())return m.NAN;if(!this.isFinite())return m.NAN;if(this.abs().gt(m.ONE))return m.NAN;if(this.eq(1))return m.ZERO;if(this.eq(-1))return m.PI;let e=m.precision,i=m.precision;m.precision=e+10;try{let t=m.TWO;if(this.significand>=0n){let s=m.ONE.sub(this).mulToPrecision(m.HALF,e+10).sqrt();return t.mulToPrecision(s.asin(),e)}let r=m.ONE.add(this).mulToPrecision(m.HALF,e+10).sqrt();return m.PI.sub(t.mul(r.asin())).toPrecision(e)}finally{m.precision=i}};m.sin=function(n){return n.sin()};m.cos=function(n){return n.cos()};m.tan=function(n){return n.tan()};m.asin=function(n){return n.asin()};m.acos=function(n){return n.acos()};m.atan=function(n){return n.atan()};m.atan2=function(n,e){let i=n instanceof m?n:new m(n);if(i.isNaN()||e.isNaN())return m.NAN;let t=m.PI,r=t.div(m.TWO);if(e.isZero())return i.isZero()?m.ZERO:i.significand>0n?r:r.neg();let s=i.div(e);return e.significand>0n?s.atan():i.significand>=0n?s.atan().add(t):s.atan().sub(t)};m.prototype.sinh=function(){if(this.isNaN())return m.NAN;if(this.isZero())return m.ZERO;if(!this.isFinite())return this.significand>0n?m.POSITIVE_INFINITY:m.NEGATIVE_INFINITY;let n=m.precision,e=ae(this);if(e<0){if(-2*e>=n+4)return this.toPrecision(n);let r=m.precision;m.precision=n-e+5;try{let s=this.exp();return s.sub(s.inv()).mulToPrecision(m.HALF,n)}finally{m.precision=r}}if(Math.abs(this.toNumber())>1.16*(n+3)){let r=this.abs().exp().div(m.TWO);return this.significand>0n?r:r.neg()}let i=this.exp(),t=i.inv();return i.sub(t).div(m.TWO)};m.prototype.cosh=function(){if(this.isNaN())return m.NAN;if(this.isZero())return m.ONE;if(!this.isFinite())return m.POSITIVE_INFINITY;let n=m.precision;if(Math.abs(this.toNumber())>1.16*(n+3))return this.abs().exp().div(m.TWO);let e=this.exp(),i=e.inv();return e.add(i).div(m.TWO)};m.prototype.tanh=function(){if(this.isNaN())return m.NAN;if(this.isZero())return m.ZERO;if(!this.isFinite())return this.significand>0n?m.ONE:m.NEGATIVE_ONE;let n=m.precision,e=ae(this);if(e<0){if(-2*e>=n+4)return this.toPrecision(n);let t=m.precision;m.precision=n-e+5;try{let r=this.mul(m.TWO).exp();return r.sub(m.ONE).div(r.add(m.ONE)).toPrecision(n)}finally{m.precision=t}}if(Math.abs(this.toNumber())>1.16*(n+3))return this.significand>0n?m.ONE:m.NEGATIVE_ONE;let i=this.mul(m.TWO).exp();return i.sub(m.ONE).div(i.add(m.ONE))};m.sinh=function(n){return n.sinh()};m.cosh=function(n){return n.cosh()};m.tanh=function(n){return n.tanh()};m.prototype.expm1=function(){if(this.isNaN())return m.NAN;if(!this.isFinite())return this.significand>0n?m.POSITIVE_INFINITY:m.NEGATIVE_ONE;if(this.isZero())return m.ZERO;let n=m.precision,e=ae(this);if(e<0&&-e>=n+2)return this.toPrecision(n);if(e<0){let i=m.precision;m.precision=n-e+5;try{return this.exp().sub(m.ONE).toPrecision(n)}finally{m.precision=i}}return this.exp().sub(m.ONE)};m.prototype.log1p=function(){if(this.isNaN())return m.NAN;if(!this.isFinite())return this.significand>0n?m.POSITIVE_INFINITY:m.NAN;if(this.isZero())return m.ZERO;let n=m.ONE.add(this);if(n.isZero())return m.NEGATIVE_INFINITY;if(n.significand<0n)return m.NAN;let e=m.precision,i=ae(this);if(i<0&&-i>=e+2)return this.toPrecision(e);if(i<0){let t=m.precision;m.precision=e-i+5;try{return m.ONE.add(this).ln().toPrecision(e)}finally{m.precision=t}}return m.ONE.add(this).ln()};m.prototype.asinh=function(){if(this.isNaN())return m.NAN;if(this.isZero())return m.ZERO;if(!this.isFinite())return this.significand>0n?m.POSITIVE_INFINITY:m.NEGATIVE_INFINITY;let n=this.significand<0n,e=this.abs(),i=m.precision,t=ae(this);if(t<0&&-2*t>=i+4)return this.toPrecision(i);let r=()=>e.add(e.mul(e).add(m.ONE).sqrt()).ln(),s;if(t<0){let o=m.precision;m.precision=i-t+5;try{s=r().toPrecision(i)}finally{m.precision=o}}else s=r();return n?s.neg():s};m.prototype.acosh=function(){if(this.isNaN())return m.NAN;if(!this.isFinite())return this.significand>0n?m.POSITIVE_INFINITY:m.NAN;if(this.lt(m.ONE))return m.NAN;if(this.eq(1))return m.ZERO;let n=this.sub(m.ONE).div(m.TWO).sqrt();return m.TWO.mul(n.asinh())};m.prototype.atanh=function(){if(this.isNaN())return m.NAN;if(!this.isFinite())return m.NAN;if(this.isZero())return m.ZERO;let n=this.abs();if(n.eq(1))return this.significand>0n?m.POSITIVE_INFINITY:m.NEGATIVE_INFINITY;if(n.gt(m.ONE))return m.NAN;let e=m.precision,i=ae(this);if(-2*i>=e+4)return this.toPrecision(e);let t=m.precision;m.precision=e-i+5;try{return m.ONE.add(this).div(m.ONE.sub(this)).ln().mulToPrecision(m.HALF,e)}finally{m.precision=t}};m.prototype.nthRoot=function(n){if(this.isNaN()||!Number.isInteger(n)||n===0)return m.NAN;if(n===1)return this;if(n===2)return this.sqrt();if(n===3)return this.cbrt();if(n<0)return this.nthRoot(-n).inv();if(this.isZero())return m.ZERO;if(!this.isFinite())return this.significand>0n?m.POSITIVE_INFINITY:n%2===0?m.NAN:m.NEGATIVE_INFINITY;if(this.significand<0n)return n%2===0?m.NAN:this.neg().nthRoot(n).neg();let e=m.precision,i=m.precision;m.precision=e+8;try{return m.exp(this.ln().div(new m(n))).toPrecision(e)}finally{m.precision=i}};m.asinh=function(n){return n.asinh()};m.acosh=function(n){return n.acosh()};m.atanh=function(n){return n.atanh()};m.expm1=function(n){return n.expm1()};m.log1p=function(n){return n.log1p()};m.nthRoot=function(n,e){return n.nthRoot(e)};function oo(n){let e=qe(n);if(e<=1023){let u=Math.cbrt(Number(n));if(Number.isFinite(u)&&u>=1)return BigInt(Math.floor(u))}let i=e-51,t=Number(n>>BigInt(i)),r=Math.cbrt(t),s=Math.floor(i/3),o=i%3;o===1&&(r*=1.2599210498948732),o===2&&(r*=1.5874010519681994);let a=BigInt(Math.round(r))<<BigInt(s);return a>0n?a:1n}var je=class extends Error{cause;value;constructor({message:e,value:i,cause:t}={}){super(e??"Operation canceled"),i&&(this.value=i),this.cause=t,this.name="CancellationError"}};function co(n){if(n!==void 0&&Date.now()>=n)throw new je({cause:"timeout",message:"Timeout exceeded"})}var rt;function fo(){return rt}function po(n,e){let i=rt;rt=n;try{return e()}finally{rt=i}}async function nd(n,e,i){let t=performance.now();for(;;){let r=performance.now(),s=16;for(;performance.now()-r<s;){let{done:o,value:a}=n.next();if(o)return a;if(i?.aborted)throw new je({value:a,cause:i.reason});if(performance.now()-t>=e)throw new je({value:a,cause:"timeout",message:`Timeout exceeded (${e}ms)`})}await new Promise(o=>setTimeout(o,0))}}function id(n,e){let i=Date.now();for(;;){let{done:t,value:r}=n.next();if(t)return r;if(Date.now()-i>=e)throw new je({value:r,cause:"timeout",message:`Timeout exceeded (${e}ms)`})}}function fc(n){let e=n;return e!=null&&typeof e=="object"&&"_kind"in e&&typeof e._kind=="string"}function rd(n){return fc(n)}function E(n){return n?._kind==="number"}function T(n,e){return n?._kind==="symbol"&&(e===void 0||n.symbol===e)}function h(n,e){return(n?._kind==="function"||n?._kind==="tensor")&&(e===void 0||n.operator===e)}function Y(n){return n?._kind==="string"}function gi(n){return n?._kind==="tensor"}function tr(n){return n?._kind==="dictionary"}function sd(n){return n?.isCollection===!0}function od(n){return n?.isIndexedCollection===!0}function xe(n){return E(n)?n.numericValue:void 0}function pe(n){return n?._kind==="symbol"?n.symbol:void 0}var mo=new Map;function rn(n){for(let[e,i]of Object.entries(n))mo.set(e,i)}function go(n){let e=n===""?"unknown-rule":n,i=mo.get(e);return i!==void 0?{id:e,description:i,registered:!0}:{id:e,description:pc(e),registered:!1}}function pc(n){if(n==="unknown-rule")return"Simplify";if(n.startsWith("fungrim:"))return`Apply identity ${n}`;if(n.includes("->"))return`Apply ${n.replace(/->/g,"\u2192")}`;if(/^[a-z0-9]+(?:[.-][a-z0-9]+)+$/.test(n)){let e=n.replace(/[.-]/g," ");return e[0].toUpperCase()+e.slice(1)}return n[0].toUpperCase()+n.slice(1)}rn({"simplify-terms":"Simplify the terms",fu:"Apply trigonometric simplification (Fu algorithm)","exp-to-trig":"Rewrite exponentials as trigonometric functions (Euler\u2019s formula)","simplify-relational-operator":"Simplify both sides of the relation",addition:"Add the terms",multiplication:"Multiply the factors",division:"Divide the terms",negation:"Negate",power:"Evaluate the power",root:"Evaluate the root",sqrt:"Evaluate the square root",rational:"Simplify the fraction",expand:"Expand the expression","cancel common polynomial factors":"Cancel the common factors","partial fraction decomposition":"Decompose into partial fractions","a/a -> 1":"Cancel the common factor: a\u2044a = 1","combined powers":"Combine the powers","combined powers with same base":"Combine powers with the same base","x^n * x^m -> x^{n+m}":"Combine powers with the same base: x\u207F\xB7x\u1D50 = x\u207F\u207A\u1D50","x * x^n -> x^{n+1}":"Combine powers with the same base: x\xB7x\u207F = x\u207F\u207A\xB9","a^m / a^n -> a^{m-n}":"Subtract the exponents: a\u1D50\u2044a\u207F = a\u1D50\u207B\u207F","a^m / a -> a^{m-1}":"Subtract the exponents: a\u1D50\u2044a = a\u1D50\u207B\xB9","a / a^n -> a^{1-n}":"Subtract the exponents: a\u2044a\u207F = a\xB9\u207B\u207F","(-x)^n -> -x^n when n is odd":"Factor out the sign: (\u2212x)\u207F = \u2212x\u207F for odd n","(-x)^n -> x^n when n is even":"Drop the sign: (\u2212x)\u207F = x\u207F for even n","(-x)^{n/m} -> x^{n/m} when n is even and m is odd":"Drop the sign: (\u2212x)\u207F\u141F\u1D50 = x\u207F\u141F\u1D50 for even n and odd m","(-x)^{n/m} -> -x^{n/m} when n and m are odd":"Factor out the sign: (\u2212x)\u207F\u141F\u1D50 = \u2212x\u207F\u141F\u1D50 for odd n and m","root(-a, n) -> -root(a, n) when n odd":"Factor the sign out of the odd root: \u207F\u221A(\u2212a) = \u2212\u207F\u221Aa","a / (b/c)^d -> a * (c/b)^d":"Dividing by (b\u2044c)\u1D48 is multiplying by (c\u2044b)\u1D48","denest \u221A(a+b\u221Ac) -> \u221Ax+\u221Ay":"Denest the radical","sqrt(x^2) -> |x|":"Apply \u221A(x\xB2) = |x|","sqrt(x^{2n}) -> |x|^n":"Apply \u221A(x\xB2\u207F) = |x|\u207F","root(x^n, n) -> x when n odd":"Apply \u207F\u221A(x\u207F) = x for odd n","root(x^n, n) -> |x| when n even":"Apply \u207F\u221A(x\u207F) = |x| for even n","root(x^m, n) -> |x|^{m/n}":"Rewrite the root as a power: \u207F\u221A(x\u1D50) = |x|\u1D50\u141F\u207F","root(1, n) -> 1":"A root of 1 is 1","root(0, n) -> 0 when n > 0":"A root of 0 is 0","root(root(x, m), n) -> x^{1/(m*n)}":"Combine the nested roots: \u207F\u221A(\u1D50\u221Ax) = x^(1\u2044(m\xB7n))","sqrt(sqrt(x)) -> x^{1/4}":"Combine the nested roots: \u221A(\u221Ax) = x^(1\u20444)","root(sqrt(x), n) -> x^{1/(2n)}":"Combine the nested roots: \u207F\u221A(\u221Ax) = x^(1\u2044(2n))","sqrt(root(x, n)) -> x^{1/(2n)}":"Combine the nested roots: \u221A(\u207F\u221Ax) = x^(1\u2044(2n))","root(product, n) -> factored":"Distribute the root over the product",ln:"Simplify the natural logarithm",log:"Simplify the logarithm","combine ln terms":"Combine the logarithms","combine log terms":"Combine the logarithms","e^ln(x) -> x":"Apply e^(ln x) = x: exp and ln are inverses","c^log_c(x) -> x":"Apply c^(log\uA700 x) = x: the exponential and the logarithm are inverses","e^(ln(x) + y) -> x * e^y":"Split the exponent: e^(ln x + y) = x\xB7e\u02B8","e^(ln(x) * y) -> x^y":"Apply e^(y\xB7ln x) = x\u02B8","c^(log_c(x) + y) -> x * c^y":"Split the exponent: c^(log\uA700 x + y) = x\xB7c\u02B8","c^(log_c(x) * y) -> x^y":"Apply c^(y\xB7log\uA700 x) = x\u02B8","ln(e^x * y) -> x + ln(y)":"Expand the logarithm: ln(e\u02E3\xB7y) = x + ln y","log_c(c) -> 1":"The logarithm of the base is 1","log_c(c^x) -> x":"Apply log\uA700(c\u02E3) = x: the logarithm and the exponential are inverses","log_c(c^x * y) -> x + log_c(y)":"Expand the logarithm: log\uA700(c\u02E3\xB7y) = x + log\uA700 y","log_c(c^x / y) -> x - log_c(y)":"Expand the logarithm: log\uA700(c\u02E3\u2044y) = x \u2212 log\uA700 y","log_c(y / c^x) -> log_c(y) - x":"Expand the logarithm: log\uA700(y\u2044c\u02E3) = log\uA700 y \u2212 x","log_c(x^n) -> n*log_c(x)":"Bring the exponent out: log(x\u207F) = n\xB7log x","log_c(x^n) -> n*log_c(|x|) when n even":"Bring the exponent out: log(x\u207F) = n\xB7log|x| for even n","log_c(x^{p/q}) -> (p/q)*log_c(x)":"Bring the exponent out: log(x\u1D56\u141F\u{107A5}) = (p\u2044q)\xB7log x","log_c(x^{p/q}) -> (p/q)*log_c(|x|) when p even":"Bring the exponent out: log(x\u1D56\u141F\u{107A5}) = (p\u2044q)\xB7log|x| for even p","ln(a)/ln(b) -> k when a = b^k":"Recognize the logarithm ratio: ln(b\u1D4F)\u2044ln(b) = k","log_{1/c}(a) -> -log_c(a)":"Invert the base: log\u2081\u2044\uA700(a) = \u2212log\uA700(a)","log_c(a) / log_c(b) -> ln(a) / ln(b)":"Change of base: log\uA700(a)\u2044log\uA700(b) = ln(a)\u2044ln(b)","log_c(a) / ln(a) -> 1/ln(c)":"Change of base: log\uA700(a)\u2044ln(a) = 1\u2044ln(c)","ln(a) / log_c(a) -> ln(c)":"Change of base: ln(a)\u2044log\uA700(a) = ln(c)","log base 0 or 1 -> NaN":"A logarithm base of 0 or 1 is undefined","log_c(0) -> NaN":"The logarithm of 0 is undefined","abs-negate":"Apply |\u2212x| = |x|","|-x| -> |x|":"Apply |\u2212x| = |x|","|x| -> x":"Drop the absolute value: the argument is non-negative","|x| -> -x":"Resolve the absolute value: the argument is non-positive","|xy| -> x|y| when x >= 0":"Move the non-negative factor out of the absolute value","|x/y| -> |x|/y when y >= 0":"Move the non-negative denominator out of the absolute value","|x/y| -> x/|y| when x >= 0":"Move the non-negative numerator out of the absolute value","|x|^n -> x^n when n is even":"Drop the absolute value: |x|\u207F = x\u207F for even n","|x^n| -> x^n when n is even":"Drop the absolute value: x\u207F \u2265 0 for even n","|x^n| -> |x|^n when n is odd":"Move the absolute value onto the base: |x\u207F| = |x|\u207F for odd n","|x|^(p/q) -> x^(p/q) when p is even":"Drop the absolute value: |x|\u1D56\u141F\u{107A5} = x\u1D56\u141F\u{107A5} for even p","|x^(p/q)| -> x^(p/q) when p is even":"Drop the absolute value: x\u1D56\u141F\u{107A5} \u2265 0 for even p","|x^(p/q)| -> |x|^(p/q) when p is odd":"Move the absolute value onto the base: |x\u1D56\u141F\u{107A5}| = |x|\u1D56\u141F\u{107A5} for odd p","sign positive":"The sign of a positive quantity is 1","sign negative":"The sign of a negative quantity is \u22121","sign zero":"The sign of zero is 0","sin\xB2(x) + cos\xB2(x) -> 1":"Apply the Pythagorean identity: sin\xB2x + cos\xB2x = 1","a*sin\xB2(x) + a*cos\xB2(x) -> a":"Apply the Pythagorean identity: sin\xB2x + cos\xB2x = 1","tan\xB2(x) + 1 -> sec\xB2(x)":"Apply the Pythagorean identity: tan\xB2x + 1 = sec\xB2x","1 + cot\xB2(x) -> csc\xB2(x)":"Apply the Pythagorean identity: 1 + cot\xB2x = csc\xB2x","sin(x)cos(y)+cos(x)sin(y) -> sin(x+y)":"Apply the angle-addition identity: sin x cos y + cos x sin y = sin(x + y)","sin(x)cos(y)-cos(x)sin(y) -> sin(x-y)":"Apply the angle-subtraction identity: sin x cos y \u2212 cos x sin y = sin(x \u2212 y)"});rn({"solve.move-terms":"Move all terms to one side","solve.simplify":"Simplify the equation","solve.apply-inverse":"Apply the inverse function to both sides","solve.equate-exponents":"The bases are equal, so equate the exponents","solve.apply-tangent":"Take the tangent of both sides to clear the inverse trigonometric functions","solve.clear-denominators":"Multiply through to clear the denominators","solve.square-both-sides":"Square both sides to eliminate the radical","solve.substitute":"Substitute a new variable","solve.substituted-equation":"Rewrite the equation in the substituted variable","solve.back-substitute":"Substitute back to the original variable","solve.factor-zero-product":"A product is zero exactly when one of its factors is zero","solve.harmonize":"Rewrite the equation in an equivalent form","solve.expand":"Expand the equation","solve.quadratic-formula":"Apply the quadratic formula","solve.rational-roots":"Find the rational roots (rational-root theorem)","solve.polynomial-roots":"Find the remaining roots of the polynomial","solve.candidates":"Candidate solutions","solve.validate-roots":"Check each candidate in the original equation; reject the extraneous ones","solve.filter-domain":"Discard solutions outside the domain of the variable","solve.roots":"The solutions","solve.template":"Solve the matched equation pattern"});rn({"solve.linear-monomial":"A multiple of the unknown is zero when the unknown is zero","solve.reciprocal":"Solve the reciprocal equation","solve.linear":"Isolate the unknown: subtract the constant, then divide by the coefficient","solve.linear-negated":"Isolate the unknown: subtract the constant, then divide by the coefficient","solve.power":"Take the n-th root of both sides","solve.power-negative-root":"Take the n-th root of both sides (negative root)","solve.quadratic-no-constant-zero":"Factor out the unknown: one solution is 0","solve.quadratic-no-constant":"Factor out the unknown and solve the remaining linear factor","solve.quadratic-formula-positive":"Apply the quadratic formula (positive branch)","solve.quadratic-formula-negative":"Apply the quadratic formula (negative branch)","solve.exponential":"Take the logarithm of both sides","solve.exponential-natural":"Take the natural logarithm of both sides","solve.exponential-natural-unit-exponent":"Take the natural logarithm of both sides","solve.exponential-natural-simple":"Take the natural logarithm of both sides","solve.exponential-natural-unit-coefficient":"Take the natural logarithm of both sides","solve.logarithm-base":"Exponentiate both sides to clear the logarithm","solve.logarithm-base-no-constant":"Exponentiate both sides to clear the logarithm","solve.absolute-value-positive":"Resolve the absolute value (positive case)","solve.absolute-value-negative":"Resolve the absolute value (negative case)","solve.quadratic-in-sqrt-positive":"Solve as a quadratic in the square root of the unknown","solve.quadratic-in-sqrt-negative":"Solve as a quadratic in the square root of the unknown","solve.quadratic-in-sqrt-negated-positive":"Solve as a quadratic in the square root of the unknown","solve.quadratic-in-sqrt-negated-negative":"Solve as a quadratic in the square root of the unknown","solve.radical":"Isolate the radical, then square both sides","solve.logarithm-natural-scaled":"Exponentiate both sides to clear the logarithm","solve.logarithm-natural":"Exponentiate both sides to clear the logarithm","solve.sine":"Apply the inverse sine","solve.sine-second-branch":"Apply the inverse sine (second branch: \u03C0 \u2212 arcsin)","solve.sine-unit":"Apply the inverse sine","solve.sine-unit-second-branch":"Apply the inverse sine (second branch: \u03C0 \u2212 arcsin)","solve.cosine":"Apply the inverse cosine","solve.cosine-negative-branch":"Apply the inverse cosine (negative branch)","solve.cosine-unit":"Apply the inverse cosine","solve.cosine-unit-negative-branch":"Apply the inverse cosine (negative branch)","solve.tangent":"Apply the inverse tangent","solve.tangent-unit":"Apply the inverse tangent","solve.cotangent":"Apply the inverse cotangent","solve.cotangent-unit":"Apply the inverse cotangent","solve.sine-cosine-linear-combination":"Rewrite a\xB7sin x + b\xB7cos x as a single sinusoid"});rn({"derivative.sum-rule":"Apply the sum rule: (u + v)\u2032 = u\u2032 + v\u2032","derivative.product-rule":"Apply the product rule: (u\xB7v)\u2032 = u\u2032\xB7v + u\xB7v\u2032","derivative.quotient-rule":"Apply the quotient rule: (u\u2044v)\u2032 = (u\u2032\xB7v \u2212 u\xB7v\u2032)\u2044v\xB2","derivative.power-rule":"Apply the power rule: (u\u207F)\u2032 = n\xB7u\u207F\u207B\xB9\xB7u\u2032","derivative.exponential-rule":"Differentiate the exponential: (a\u1D58)\u2032 = a\u1D58\xB7ln(a)\xB7u\u2032","derivative.general-power-rule":"Differentiate by logarithmic differentiation: (f^g)\u2032 = f^g\xB7(g\u2032\xB7ln f + g\xB7f\u2032\u2044f)","derivative.chain-rule":"Apply the chain rule: f(u)\u2032 = f\u2032(u)\xB7u\u2032","derivative.known-derivative":"Differentiate using a known derivative","derivative.constant-multiple":"Apply the constant-multiple rule: (c\xB7u)\u2032 = c\xB7u\u2032","derivative.rewrite":"Rewrite in an equivalent differentiable form","derivative.expand-definition":"Expand the definition of the function","derivative.zero":"The expression is locally constant: its derivative is 0","derivative.simplify":"Simplify the result"});{let n=["Sin","Tan","Cot","Csc","Sinh","Tanh","Coth","Csch","Arcsin","Arctan","Arccsc","Arsinh","Artanh","Arcsch"],e=["Cos","Sec","Cosh","Sech"],i={};for(let t of n){let r=t.toLowerCase();i[`${t}(-x) -> -${t}(x)`]=`Use the odd symmetry: ${r}(\u2212x) = \u2212${r}(x)`}for(let t of e){let r=t.toLowerCase();i[`${t}(-x) -> ${t}(x)`]=`Use the even symmetry: ${r}(\u2212x) = ${r}(x)`}rn(i)}{let n=["Sin","Tan","Cot","Csc","Sinh","Tanh","Coth","Csch","Arcsin","Arctan","Arccot","Arccsc","Arsinh","Artanh","Arcoth","Arcsch"],e=["Cos","Sec","Cosh","Sech"],i={};for(let t of n){let r=t.toLowerCase();i[`|${t}(x)| -> ${t}(|x|) (odd function)`]=`Move the absolute value onto the argument: |${r}(x)| = ${r}(|x|) because ${r} is odd`}for(let t of e){let r=t.toLowerCase();i[`${t}(|x|) -> ${t}(x) (even function)`]=`Drop the absolute value: ${r}(|x|) = ${r}(x) because ${r} is even`}rn(i)}rn({"Sin(\u03C0 + x) -> -Sin(x)":"Shift the angle by \u03C0: sin(\u03C0 + x) = \u2212sin(x)","Cos(\u03C0 + x) -> -Cos(x)":"Shift the angle by \u03C0: cos(\u03C0 + x) = \u2212cos(x)","Tan(\u03C0 + x) -> Tan(x)":"Use the period \u03C0 of tangent: tan(\u03C0 + x) = tan(x)","Cot(\u03C0 + x) -> Cot(x)":"Use the period \u03C0 of cotangent: cot(\u03C0 + x) = cot(x)","Sec(\u03C0 + x) -> -Sec(x)":"Shift the angle by \u03C0: sec(\u03C0 + x) = \u2212sec(x)","Csc(\u03C0 + x) -> -Csc(x)":"Shift the angle by \u03C0: csc(\u03C0 + x) = \u2212csc(x)","Sin(\u03C0/2 - x) -> Cos(x)":"Apply the cofunction identity: sin(\u03C0\u20442 \u2212 x) = cos(x)","Cos(\u03C0/2 - x) -> Sin(x)":"Apply the cofunction identity: cos(\u03C0\u20442 \u2212 x) = sin(x)","Tan(\u03C0/2 - x) -> Cot(x)":"Apply the cofunction identity: tan(\u03C0\u20442 \u2212 x) = cot(x)","Cot(\u03C0/2 - x) -> Tan(x)":"Apply the cofunction identity: cot(\u03C0\u20442 \u2212 x) = tan(x)","Sec(\u03C0/2 - x) -> Csc(x)":"Apply the cofunction identity: sec(\u03C0\u20442 \u2212 x) = csc(x)","Csc(\u03C0/2 - x) -> Sec(x)":"Apply the cofunction identity: csc(\u03C0\u20442 \u2212 x) = sec(x)"});{let n=["Sin","Cos","Tan","Cot","Sec","Csc","Arcsin","Arccos"],e={};for(let i of n)e[`${i}(infinity) -> NaN`]=`${i.toLowerCase()} has no limit at infinity`;for(let i of["arctan(+inf) -> \u03C0/2","arctan(-inf) -> -\u03C0/2","arccot(+inf) -> 0","arccot(-inf) -> \u03C0","arcsec(\xB1inf) -> \u03C0/2","arccsc(\xB1inf) -> 0","sinh(+inf) -> +inf","sinh(-inf) -> -inf","cosh(+inf) -> +inf","cosh(-inf) -> +inf","tanh(+inf) -> 1","tanh(-inf) -> -1","coth(+inf) -> 1","coth(-inf) -> -1","sech(+inf) -> 0","sech(-inf) -> 0","csch(+inf) -> 0","csch(-inf) -> 0","arsinh(+inf) -> +inf","arsinh(-inf) -> -inf","arcosh(+inf) -> +inf","arcoth(\xB1inf) -> 0","arcsch(\xB1inf) -> 0","ln(+inf) -> +inf","log_c(+inf) -> +inf when c > 1","log_c(+inf) -> -inf when 0 < c < 1","log_c(0) -> -inf when c > 1","log_c(0) -> +inf when 0 < c < 1","log_inf(x) -> 0","root(+inf, n) -> +inf when n > 0"])e[i]="Evaluate the limit at infinity";for(let i of["artanh(\xB1inf) -> NaN","arsech(\xB1inf) -> NaN","arcosh(-inf) -> NaN","log_inf(inf) -> NaN"])e[i]="The value is undefined at infinity";for(let i of["root(x, 0) -> NaN","root(0, n) -> NaN when n <= 0"])e[i]="The root is undefined";rn(e)}var A=245,hi=260,Ze=270,H=275,Z=390,ye=600,rr=650,xi=700,sr=810;function ho(n){return!("kind"in n)||n.kind==="expression"}function xo(n){return"kind"in n&&n.kind==="symbol"}function yi(n){return"kind"in n&&n.kind==="matchfix"}function or(n){return"kind"in n&&n.kind==="infix"}function ar(n){return"kind"in n&&n.kind==="prefix"}function ur(n){return"kind"in n&&n.kind==="postfix"}function yo(n){return"kind"in n&&n.kind==="environment"}var bn=[{latexTrigger:["\\not","<"],kind:"infix",associativity:"any",precedence:246,parse:"NotLess"},{name:"NotLess",latexTrigger:["\\nless"],kind:"infix",associativity:"any",precedence:246},{latexTrigger:["<"],kind:"infix",associativity:"any",precedence:245,parse:"Less"},{name:"Less",latexTrigger:["\\lt"],kind:"infix",associativity:"any",precedence:245},{latexTrigger:["<","="],kind:"infix",associativity:"any",precedence:241,parse:"LessEqual"},{name:"LessEqual",latexTrigger:["\\le"],kind:"infix",associativity:"any",precedence:241},{latexTrigger:["\\leq"],kind:"infix",associativity:"any",precedence:241,parse:"LessEqual"},{latexTrigger:["\\leqslant"],kind:"infix",associativity:"any",precedence:A+5,parse:"LessEqual"},{latexTrigger:["\u2264"],kind:"infix",associativity:"any",precedence:241,parse:"LessEqual"},{latexTrigger:["\u2265"],kind:"infix",associativity:"any",precedence:242,parse:"GreaterEqual"},{latexTrigger:["\u2260"],kind:"infix",associativity:"right",precedence:255,parse:"NotEqual"},{name:"LessNotEqual",latexTrigger:["\\lneqq"],kind:"infix",associativity:"any",precedence:A},{name:"NotLessNotEqual",latexTrigger:["\\nleqq"],kind:"infix",associativity:"any",precedence:A},{name:"LessOverEqual",latexTrigger:["\\leqq"],kind:"infix",associativity:"any",precedence:A+5},{name:"GreaterOverEqual",latexTrigger:["\\geqq"],kind:"infix",associativity:"any",precedence:A+5,parse:"GreaterEqual"},{name:"Equal",latexTrigger:["="],kind:"infix",associativity:"right",precedence:A},{latexTrigger:["*","="],kind:"infix",associativity:"right",precedence:A,parse:"StarEqual"},{name:"StarEqual",latexTrigger:["\\star","="],kind:"infix",associativity:"right",precedence:A},{name:"PlusEqual",latexTrigger:["+","="],kind:"infix",associativity:"right",precedence:A},{name:"MinusEqual",latexTrigger:["-","="],kind:"infix",associativity:"right",precedence:A},{name:"SlashEqual",latexTrigger:["/","="],kind:"infix",associativity:"right",precedence:A},{latexTrigger:["=","="],kind:"infix",associativity:"right",precedence:A,parse:"Equal"},{name:"EqualEqualEqual",latexTrigger:["=","=","="],kind:"infix",associativity:"right",precedence:A+5},{name:"Tilde",latexTrigger:["\\sim"],kind:"infix",associativity:"right",precedence:A},{name:"NotTilde",latexTrigger:["\\nsim"],kind:"infix",associativity:"right",precedence:A},{name:"TildeEqual",latexTrigger:["\\simeq"],kind:"infix",associativity:"right",precedence:A},{name:"TildeFullEqual",latexTrigger:["\\cong"],kind:"infix",associativity:"right",precedence:A},{name:"NotTildeFullEqual",latexTrigger:["\\ncong"],kind:"infix",associativity:"right",precedence:A},{name:"Approx",latexTrigger:["\\approx"],kind:"infix",associativity:"right",precedence:247},{latexTrigger:["\u2248"],kind:"infix",associativity:"right",precedence:247,parse:"Approx"},{name:"NotApprox",latexTrigger:["\\not","\\approx"],kind:"infix",associativity:"right",precedence:247},{name:"ApproxEqual",latexTrigger:["\\approxeq"],kind:"infix",associativity:"right",precedence:A},{name:"NotApproxEqual",latexTrigger:["\\not","\\approxeq"],kind:"infix",associativity:"right",precedence:250},{name:"NotEqual",latexTrigger:["\\ne"],kind:"infix",associativity:"right",precedence:255},{latexTrigger:["\\neq"],kind:"infix",associativity:"right",precedence:255,parse:"NotEqual"},{name:"Unequal",latexTrigger:["!","="],kind:"infix",associativity:"right",precedence:A,parse:"NotEqual"},{name:"GreaterEqual",latexTrigger:["\\ge"],kind:"infix",associativity:"right",precedence:242},{latexTrigger:["\\geq"],kind:"infix",associativity:"right",precedence:242,parse:"GreaterEqual"},{latexTrigger:[">","="],kind:"infix",associativity:"right",precedence:243,parse:"GreaterEqual"},{latexTrigger:["\\geqslant"],kind:"infix",associativity:"right",precedence:A+5,parse:"GreaterEqual"},{name:"GreaterNotEqual",latexTrigger:["\\gneqq"],kind:"infix",associativity:"right",precedence:A},{name:"NotGreaterNotEqual",latexTrigger:["\\ngeqq"],kind:"infix",associativity:"right",precedence:A},{latexTrigger:[">"],kind:"infix",associativity:"right",precedence:245,parse:"Greater"},{name:"Greater",latexTrigger:["\\gt"],kind:"infix",associativity:"right",precedence:245},{name:"NotGreater",latexTrigger:["\\ngtr"],kind:"infix",associativity:"right",precedence:244},{latexTrigger:["\\not",">"],kind:"infix",associativity:"right",precedence:244,parse:"NotGreater"},{name:"RingEqual",latexTrigger:["\\circeq"],kind:"infix",associativity:"right",precedence:A},{name:"TriangleEqual",latexTrigger:["\\triangleq"],kind:"infix",associativity:"right",precedence:A},{name:"DotEqual",latexTrigger:["\\doteq"],kind:"infix",associativity:"right",precedence:A+5},{name:"DotEqualDot",latexTrigger:["\\doteqdot"],kind:"infix",associativity:"right",precedence:A+5},{name:"FallingDotEqual",latexTrigger:["\\fallingdotseq"],kind:"infix",associativity:"right",precedence:A+5},{name:"RisingDotEqual",latexTrigger:["\\fallingdotseq"],kind:"infix",associativity:"right",precedence:A+5},{name:"QuestionEqual",latexTrigger:["\\questeq"],kind:"infix",associativity:"right",precedence:A},{name:"MuchLess",latexTrigger:["\\ll"],kind:"infix",associativity:"right",precedence:A},{name:"MuchGreater",latexTrigger:["\\gg"],kind:"infix",associativity:"right",precedence:A},{name:"Precedes",latexTrigger:["\\prec"],kind:"infix",associativity:"right",precedence:A},{name:"Succeeds",latexTrigger:["\\succ"],kind:"infix",associativity:"right",precedence:A},{name:"PrecedesEqual",latexTrigger:["\\preccurlyeq"],kind:"infix",associativity:"right",precedence:A},{name:"SucceedsEqual",latexTrigger:["\\curlyeqprec"],kind:"infix",associativity:"right",precedence:A},{name:"NotPrecedes",latexTrigger:["\\nprec"],kind:"infix",associativity:"right",precedence:A},{name:"NotSucceeds",latexTrigger:["\\nsucc"],kind:"infix",associativity:"right",precedence:A},{name:"Between",latexTrigger:["\\between"],kind:"infix",associativity:"right",precedence:A+5}];var bi=["Error","'missing'"];function De(n){return!!(typeof n=="number"||sn(n)||typeof n=="string"&&Jn(n))}function sn(n){return n!==null&&typeof n=="object"&&"num"in n}function Cn(n){return n!==null&&typeof n=="object"&&"sym"in n}function fr(n){return n!==null&&typeof n=="object"&&"str"in n}function No(n){return n!==null&&typeof n=="object"&&"dict"in n&&typeof n.dict=="object"&&!Array.isArray(n.dict)&&n.dict!==null}function Bn(n){return n!==null&&typeof n=="object"&&"fn"in n&&Array.isArray(n.fn)&&n.fn.length>0&&typeof n.fn[0]=="string"}function mc(n){return n!==null&&typeof n=="object"&&("fn"in n||"num"in n||"sym"in n||"str"in n)}function md(n){return mc(n)&&(n.latex!==void 0||n.wikidata!==void 0||n.sourceOffsets!==void 0)}function B(n){return n==null?null:typeof n=="object"&&"str"in n?n.str:typeof n!="string"?null:n.length>=2&&n.at(0)==="'"&&n.at(-1)==="'"?n.substring(1,n.length-1):Jn(n)||Ei(n)?null:n}function pr(n){if(n==null||B(n)!==null)return null;let e=x(n);return e?[e,...N(n).map(i=>pr(i)).filter(i=>i!==null)]:n}function x(n){return Array.isArray(n)?n[0]:n==null?"":Bn(n)?n.fn[0]:""}function N(n){return Array.isArray(n)?n.slice(1):n!==void 0&&Bn(n)?n.fn.slice(1):[]}function d(n,e){return Array.isArray(n)?n[e]??null:n===null||!Bn(n)?null:n.fn[e]??null}function G(n){return n==null?0:Array.isArray(n)?Math.max(0,n.length-1):Bn(n)?Math.max(0,n.fn.length-1):0}function mr(n){return n==null?null:x(n)==="Hold"?d(n,1):n}function I(n){return typeof n=="string"&&Ei(n)?n.length>=2&&n.at(0)==="`"&&n.at(-1)==="`"?n.slice(1,-1):n:n==null?null:Cn(n)?n.sym:null}function bo(n){let e=x(n);if(e==="KeyValuePair"||e==="Tuple"||e==="Pair"){let[i,t]=N(n),r=B(i);return r?[r,t??"Nothing"]:null}return null}function dr(n){if(n===null)return null;if(No(n))return n;let e=bo(n);if(e)return{dict:{[e[0]]:Eo(e[1])??"Nothing"}};if(x(n)==="Dictionary"){let i={};for(let t of N(n)){let r=bo(t);r&&(i[r[0]]=Eo(r[1])??"Nothing")}return{dict:i}}return null}function st(n){return{dict:Object.fromEntries(Object.entries(n).map(([i,t])=>[i,cr(t)??"Nothing"]))}}function dc(n){if(n=n.toLowerCase().replace(/[nd]$/,"").replace(/[\u0009-\u000d\u0020\u00a0]/g,""),n==="nan")return NaN;if(/^(infinity|\+infinity|oo|\+oo)$/i.test(n))return 1/0;if(/^(-infinity|-oo)$/.test(n))return-1/0;if(/\([0-9]+\)/.test(n)){let[e,i,t,r]=n.match(/(.+)\(([0-9]+)\)(.*)$/)??[];n=i+t.repeat(Math.ceil(16/t.length))+(r??"")}return parseFloat(n)}function D(n){return typeof n=="number"?n:typeof n=="string"&&Jn(n)?dc(n):n!==void 0&&sn(n)?D(n.num):null}function On(n){if(n==null)return null;if(I(n)==="Half")return[1,2];let e=x(n);if(!e)return null;let i=null,t=null;if(e==="Negate"){let r=On(N(n)[0]);if(r)return[-r[0],r[1]]}if(e==="Rational"||e==="Divide"){let[r,s]=N(n);i=D(r)??NaN,t=D(s)??NaN}if(e==="Power"){let[r,s]=N(n),o=D(s);o===1?(i=D(r),t=1):o===-1&&(i=1,t=D(r))}if(e==="Multiply"){let[r,s]=N(n);if(x(s)==="Power"){let[o,a]=N(s);D(a)===-1&&(i=D(r),t=D(o))}}return i===null||t===null?null:Number.isInteger(i)&&Number.isInteger(t)?[i,t]:null}function ot(n,e){let i=null;if(Array.isArray(n)&&(i=n),Bn(n)&&(i=n.fn),i===null)return[];let t=1,r=[];for(;t<i.length;)r.push(e(i[t])),t+=1;return r}function En(n,e,i){let t=x(e),r=x(i);return t===n&&r===n?[n,...N(e),...N(i)]:t===n?[n,...N(e),i]:r===n?[n,e,...N(i)]:[n,e,i]}function on(n){if(n==null)return null;let e=x(n);if(e==="Delimiter"){if(n=d(n,1),n===null)return[];if(e=x(n),e!=="Sequence")return[n]}return e!=="Sequence"?null:N(n)}function R(n){return n==null||n==="Nothing"?!0:x(n)==="Sequence"&&G(n)===0}function _(n){return R(n)?bi:n}function lr(n){return n[0]==="Square"?lr(n.slice(1))+2:n.reduce((e,i)=>e+Fn(i),0)}function Fn(n){if(n===null)return 0;if(typeof n=="number"||typeof n=="string"||De(n)||Cn(n)||fr(n))return 1;if(Array.isArray(n))return lr(n);if("fn"in n)return lr(n.fn);let e=dr(n);if(e){let i=e,t=Object.keys(i);return 1+t.length+t.reduce((r,s)=>r+Fn(i[s]),0)}return 0}function Jn(n){return/^(nan|oo|\+oo|-oo|infinity|\+infinity|-infinity)$/i.test(n)||/^[+-]?(0|[1-9][0-9]*)(\.([0-9]+(\([0-9]+\))?|\([0-9]+\)))?([eE][+-]?[0-9]+)?$/.test(n)}function Ei(n){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n)||n.length>=2&&n[0]==="`"&&n[n.length-1]==="`"}function To(n){return n.length>=2&&n[0]==="'"&&n[n.length-1]==="'"?!0:!Jn(n)&&!Ei(n)}function cr(n){if(typeof n=="string")return{str:n};if(typeof n=="number")return{num:n.toString()};if(typeof n=="boolean")return n?"True":"False";if(Array.isArray(n))return["List",...n.map(e=>cr(e)??"Nothing")];if(n===null)return null;if(typeof n=="object"){let e={};for(let i in n)e[i]=cr(n[i])??"Nothing";return{dict:e}}return Bn(n)||Cn(n)||sn(n)||fr(n)||No(n)?n:null}function Eo(n){return n==null?null:fr(n)?n.str:sn(n)?parseFloat(n.num):Cn(n)?n.sym:typeof n=="string"||typeof n=="number"?n:Array.isArray(n)?{fn:n}:n}function gc(n){let e=n.index;n.skipVisualSpace();let i=!1;return n.match("(")&&(n.skipVisualSpace(),i=n.peek==="\\bmod"||n.peek==="\\pmod"||n.peek==="\\mod"||n.matchAll(["m","o","d"])),n.index=e,i}function hc(n,e){let i=n.index;if(n.skipVisualSpace(),n.match("(")){if(n.skipVisualSpace(),n.match("\\bmod")||n.match("\\pmod")||n.match("\\mod")||n.matchAll(["m","o","d"])){n.skipVisualSpace();let s=n.parseExpression({...e,minPrec:0})??n.parseGroup();if(n.skipVisualSpace(),s!==null&&n.match(")"))return s}return n.index=i,null}let t=n.parseExpression({...e,minPrec:219});if(t!==null&&x(t)==="Mod"){let r=G(t)>=2?d(t,2):d(t,1);if(r!==null)return r}return n.index=i,null}function vo(n,e,i){let t=n.parseExpression({...i,minPrec:219,condition:s=>gc(s)||(i.condition?.(s)??!1)}),r=hc(n,i);return r!==null?["Congruent",e,_(t),r]:["Equivalent",e,_(t)]}var Io=[{name:"True",kind:"symbol",latexTrigger:["\\top"]},{kind:"symbol",latexTrigger:"\\mathrm{True}",parse:"True"},{kind:"symbol",latexTrigger:"\\operatorname{True}",parse:"True"},{kind:"symbol",latexTrigger:"\\mathsf{T}",parse:"True"},{name:"False",kind:"symbol",latexTrigger:["\\bot"]},{kind:"symbol",latexTrigger:"\\operatorname{False}",parse:"False"},{kind:"symbol",latexTrigger:"\\mathsf{F}",parse:"False"},{name:"And",kind:"infix",latexTrigger:["\\land"],precedence:235},{kind:"infix",latexTrigger:["\\wedge"],parse:"And",precedence:235},{kind:"infix",latexTrigger:"\\&",parse:"And",precedence:235},{kind:"infix",latexTrigger:"\\operatorname{and}",parse:"And",precedence:235},{name:"Or",kind:"infix",latexTrigger:["\\lor"],precedence:230},{kind:"infix",latexTrigger:["\\vee"],parse:"Or",precedence:230},{kind:"infix",latexTrigger:"\\operatorname{or}",parse:"Or",precedence:230},{name:"Xor",kind:"infix",latexTrigger:["\\veebar"],precedence:232},{name:"Not",kind:"prefix",latexTrigger:["\\lnot"],precedence:880},{kind:"prefix",latexTrigger:["\\neg"],parse:"Not",precedence:880},{name:"Nand",kind:"infix",latexTrigger:["\\barwedge"],precedence:232},{name:"Nor",kind:"infix",latexTrigger:["\u22BD"],precedence:232},{kind:"function",symbolTrigger:"and",parse:"And"},{kind:"function",symbolTrigger:"or",parse:"Or"},{kind:"function",symbolTrigger:"not",parse:"Not"},{name:"Implies",kind:"infix",precedence:220,associativity:"right",latexTrigger:["\\implies"],serialize:"\\implies"},{latexTrigger:["\\Rightarrow"],kind:"infix",precedence:220,associativity:"right",parse:"Implies"},{latexTrigger:["\\Longrightarrow"],kind:"infix",precedence:220,associativity:"right",parse:"Implies"},{latexTrigger:["\\longrightarrow"],kind:"infix",precedence:220,associativity:"right",parse:"Implies"},{latexTrigger:["=",">"],kind:"infix",precedence:220,associativity:"right",parse:(n,e,i)=>{if(n.options.strict!==!1)return null;let t=n.parseExpression({...i,minPrec:220});return t===null?null:["Implies",e,t]}},{name:"Equivalent",latexTrigger:["\\iff"],kind:"infix",associativity:"right",precedence:219},{latexTrigger:["\\Leftrightarrow"],kind:"infix",associativity:"right",precedence:219,parse:"Equivalent"},{latexTrigger:["\\leftrightarrow"],kind:"infix",associativity:"right",precedence:219,parse:"Equivalent"},{latexTrigger:["\\Longleftrightarrow"],kind:"infix",associativity:"right",precedence:219,parse:"Equivalent"},{latexTrigger:["\\longleftrightarrow"],kind:"infix",associativity:"right",precedence:219,parse:"Equivalent"},{latexTrigger:["<","=",">"],kind:"infix",precedence:219,associativity:"right",parse:(n,e,i)=>{if(n.options.strict!==!1)return null;let t=n.parseExpression({...i,minPrec:219});return t===null?null:["Equivalent",e,t]}},{latexTrigger:["\\equiv"],kind:"infix",associativity:"right",precedence:219,parse:vo},{latexTrigger:["\u2261"],kind:"infix",associativity:"right",precedence:219,parse:vo},{name:"Proves",kind:"infix",latexTrigger:["\\vdash"],precedence:220,associativity:"right",serialize:"\\vdash"},{name:"Entails",kind:"infix",latexTrigger:["\\vDash"],precedence:220,associativity:"right",serialize:"\\vDash"},{name:"Satisfies",kind:"infix",latexTrigger:["\\models"],precedence:220,associativity:"right",serialize:"\\models"},{name:"ForAll",kind:"prefix",latexTrigger:["\\forall"],precedence:200,serialize:Ni("\\forall"),parse:an("ForAll")},{name:"Exists",kind:"prefix",latexTrigger:["\\exists"],precedence:200,serialize:Ni("\\exists"),parse:an("Exists")},{name:"ExistsUnique",kind:"prefix",latexTrigger:["\\exists","!"],precedence:200,serialize:Ni("\\exists!"),parse:an("ExistsUnique")},{name:"NotForAll",kind:"prefix",latexTrigger:["\\lnot","\\forall"],precedence:200,serialize:Ni("\\lnot\\forall"),parse:an("NotForAll")},{name:"NotExists",kind:"prefix",latexTrigger:["\\lnot","\\exists"],precedence:200,serialize:Ni("\\lnot\\exists"),parse:an("NotExists")},{name:"KroneckerDelta",kind:"prefix",latexTrigger:["\\delta","_"],precedence:200,serialize:(n,e)=>{let i=N(e);return i.length===0?"\\delta":i.every(t=>I(t))?`\\delta_{${i.map(t=>n.serialize(t)).join("")}}`:`\\delta_{${i.map(t=>n.serialize(t)).join(", ")}}`},parse:n=>{let e=n.parseGroup();if(e===null){let t=n.parseToken();return t?["KroneckerDelta",t]:null}let i=on(e);return i&&i.length<=2?["KroneckerDelta",...i]:x(e)==="InvisibleOperator"?["KroneckerDelta",...N(e)]:e!==null?["KroneckerDelta",e]:null}},{name:"Boole",kind:"matchfix",openTrigger:"[",closeTrigger:"]",parse:(n,e)=>{let i=x(e);return!i||!bn.some(t=>t.name===i)?null:["Boole",e]}},{kind:"matchfix",openTrigger:"\\llbracket",closeTrigger:"\\rrbracket",parse:(n,e)=>{let i=x(e);return!i||!bn.some(t=>t.name===i)?null:["Boole",e]}},{name:"Predicate",serialize:(n,e)=>{let i=N(e);if(i.length===0)return"";let t=i[0],r=typeof t=="string"?t:n.serialize(t);if(i.length===1)return r;let s=i.slice(1).map(o=>n.serialize(o));return`${r}(${s.join(", ")})`}}];function Ni(n){return(e,i)=>{let t=N(i);if(t.length===0)return n;if(t.length===1)return`${n} ${e.serialize(t[0])}`;let r=e.serialize(t[0]),s=e.serialize(t[1]);return`${n} ${r}, ${s}`}}function So(n,e){return n.peek==="\\to"||n.peek==="\\rightarrow"||n.peek==="\\implies"||n.peek==="\\Rightarrow"||n.peek==="\\iff"||n.peek==="\\Leftrightarrow"||n.peek==="\\land"||n.peek==="\\wedge"||n.peek==="\\lor"||n.peek==="\\vee"||(e?.condition?.(n)??!1)}function an(n){return(e,i)=>{let t=e.index,r=e.options.quantifierScope!=="loose",s=e.parseSymbol(i);if(s){if(e.skipSpace(),e.match(",")||e.match("\\mid")||e.match(".")||e.match(":")||e.match("\\colon")){let l=r?{...i,condition:f=>So(f,i)}:i;e.enterQuantifierScope();let c=e.parseExpression(l);return e.exitQuantifierScope(),[n,s,_(c)]}e.enterQuantifierScope();let u=e.parseEnclosure();if(e.exitQuantifierScope(),u)return[n,s,_(u)]}e.index=t;let o={...i,condition:u=>u.peek===":"||u.peek==="\\colon"||(i?.condition?.(u)??!1)},a=e.parseExpression(o);if(a===null)return null;if(e.skipSpace(),e.matchAny([",","\\mid",":","\\colon"])){let u=r?{...i,condition:c=>So(c,i)}:i;e.enterQuantifierScope();let l=e.parseExpression(u);return e.exitQuantifierScope(),[n,a,_(l)]}if(e.match("(")){e.enterQuantifierScope();let u=e.parseExpression(i);return e.exitQuantifierScope(),e.match(")")?[n,a,_(u)]:null}return x(a)!==""?[n,a,"True"]:null}}function xc(n){let e=[];for(let i=0;i<n.length;i++){let t=n.charCodeAt(i);if(t>=55296&&t<=56319){let r=n.charCodeAt(i+1);if(r>=56320&&r<=57343){let s=t-55296,o=r-56320;t=2**16+s*2**10+o,i++}}e.push(t)}return e}var at=8205,ko=[127462,127487];function Mo(n){return n===at||n===65038||n===65039||n>=127995&&n<=128e3||n>=129456&&n<=129460||n>=917536&&n<=917632}function yc(n){return n>=ko[0]&&n<=ko[1]}function Do(n){if(/^[\u0020-\u00FF]*$/.test(n))return n;let e=[],i=xc(n),t=0;for(;t<i.length;){let r=i[t++],s=i[t];if(s===at){let o=t-1;for(t+=2;i[t]===at;)t+=2;e.push(String.fromCodePoint(...i.slice(o,2*t-o+1)))}else if(Mo(s)){let o=t-1;for(;Mo(i[t]);)t+=i[t]===at?2:1;e.push(String.fromCodePoint(...i.slice(o,2*t-o-1)))}else yc(r)?(t+=1,e.push(String.fromCodePoint(...i.slice(t-2,2)))):e.push(String.fromCodePoint(r))}return e}var bc={"\u2070":"0","\xB9":"1","\xB2":"2","\xB3":"3","\u2074":"4","\u2075":"5","\u2076":"6","\u2077":"7","\u2078":"8","\u2079":"9","\u207B":"-","\u2071":"i",\u207F:"n"},Ec={"\u2080":"0","\u2081":"1","\u2082":"2","\u2083":"3","\u2084":"4","\u2085":"5","\u2086":"6","\u2087":"7","\u2088":"8","\u2089":"9","\u208B":"-"},wo=new Map;function Nc(n){let e=wo.get(n.source);if(!e){let i=n.source.startsWith("^")?n.source.slice(1):n.source;e=new RegExp(i,"y"),wo.set(n.source,e)}return e}var gr=class{s;pos;joined;offsets=null;obeyspaces=!1;constructor(e){if(e=e.normalize("NFC"),e=e.replace(/[\u200E\u200F\u2066-\u2069\u202A-\u202E]/g,""),e=e.replace(/\u2212/g,"-"),e=e.replace(/[⁰¹²³⁴⁵⁶⁷⁸⁹⁻ⁱⁿ]+/g,i=>`^{${Array.from(i).map(r=>bc[r]).join("")}}`),e=e.replace(/[₀₁₂₃₄₅₆₇₈₉₋]+/g,i=>`_{${Array.from(i).map(r=>Ec[r]).join("")}}`),this.s=Do(e),this.pos=0,typeof this.s=="string")this.joined=this.s;else{this.joined=this.s.join("");let i=new Array(this.s.length+1),t=0;for(let r=0;r<this.s.length;r++)i[r]=t,t+=this.s[r].length;i[this.s.length]=t,this.offsets=i}}end(){return this.pos>=this.s.length}get(){return this.pos<this.s.length?this.s[this.pos++]:""}peek(){return this.s[this.pos]}match(e){let i=Nc(e);typeof this.s=="string"?i.lastIndex=this.pos:i.lastIndex=this.offsets[this.pos<this.s.length?this.pos:this.s.length];let t=i.exec(this.joined);return t?.[0]?(this.pos+=t[0].length,t[0]):null}next(){if(this.end())return null;if(!this.obeyspaces&&this.match(/^[ \f\n\r\t\v\xA0\u2028\u2029]+/))return"<space>";if(this.obeyspaces&&this.match(/^[ \f\n\r\t\v\xA0\u2028\u2029]/))return"<space>";let e=this.get();if(e==="\\"){if(!this.end()){let i=this.match(/^[a-zA-Z]+/);if(i)this.match(/^[ \f\n\r\t\v\xA0\u2028\u2029]*/);else if(i=this.get(),i===" ")return"<space>";return"\\"+i}}else{if(e==="{")return"<{>";if(e==="}")return"<}>";if(e==="^"){if(this.peek()==="^"){this.get();let i=this.match(/^(\^(\^(\^(\^[0-9a-f])?[0-9a-f])?[0-9a-f])?[0-9a-f])?[0-9a-f][0-9a-f]/);if(i)return String.fromCodePoint(parseInt(i.slice(i.lastIndexOf("^")+1),16))}return e}else if(e==="#"){if(!this.end()){let i=!1;if(/[0-9?]/.test(this.peek())&&(i=!0,this.pos+1<this.s.length)){let t=this.s[this.pos+1];i=/[^0-9A-Za-z]/.test(t)}return i?"#"+this.get():"#"}}else if(e==="$")return this.peek()==="$"?(this.get(),"<$$>"):"<$>"}return e}};function Tc(n,e){let i=n.next();if(!i)return[];let t=[];if(i!=="\\relax"){if(i==="\\noexpand")i=n.next(),i&&t.push(i);else if(i==="\\obeyspaces")n.obeyspaces=!0;else if(i==="\\space"||i==="~")t.push("<space>");else if(i==="\\bgroup")t.push("<{>");else if(i==="\\egroup")t.push("<}>");else if(i==="\\string")i=n.next(),i&&(i[0]==="\\"?Array.from(i).forEach(r=>t.push(r==="\\"?"\\backslash":r)):i==="<{>"?t.push("\\{"):i==="<space>"?t.push("~"):i==="<}>"&&t.push("\\}"));else if(i==="\\csname"){let r="",s=!1,o=[];do o.length===0&&(i=n.next(),o=i?[i]:[]),s=o.length===0,!s&&i==="\\endcsname"&&(s=!0,o.shift()),s||(s=i==="<$>"||i==="<$$>"||i==="<{>"||i==="<}>"||!!i&&i.length>1&&i[0]==="\\"),s||(r+=o.shift());while(!s);r&&t.push("\\"+r),t=t.concat(o)}else if(i!=="\\endcsname")if(i.length>1&&i[0]==="#"){let r=i.slice(1),s=e;t=t.concat(W(s?.[r]??s?.["?"]??"\\placeholder{}",e))}else t.push(i)}return t}function W(n,e=[]){let i=n.toString().split(/\r?\n/),t="",r="";for(let a of i){t+=r,r=" ";let u=a.match(/((?:\\%)|[^%])*/);u!==null&&(t+=u[0])}let s=new gr(t),o=[];do o.push(...Tc(s,e));while(!s.end());return o}function ut(n){return W(n).length}function v(n){let e="",i="";for(let t of n)t!=null&&(typeof t=="string"&&(/[a-zA-Z]/.test(t[0])&&(i+=e),/\\[a-zA-Z]+\*?$/.test(t)?e=" ":e=""),i+=t.toString());return i}function Ue(n,e,i){return e.includes(n)&&(e=`{${e}}`),/^[0-9]$/.test(i)?`${e}${n}${i}`:`${e}${n}{${i}}`}function we(n){let e=[];if(Array.isArray(n))for(let t of n)if(Array.isArray(t))for(let r of t)e.push(r);else e.push(t);else e=[n];return v(e.map(t=>({"<space>":" ","<$$>":"$$","<$>":"$","<{>":"{","<}>":"}"})[t]??t))}function Po(n){return typeof n=="string"?n.startsWith("$")&&n.endsWith("$"):!1}function vc(n){if(typeof n=="number")return n.toString();if(typeof n=="string"){let e=n.trim();if(e.startsWith("$$")&&e.endsWith("$$"))return e.slice(2,-2);if(e.startsWith("$")&&e.endsWith("$"))return e.slice(1,-1)}return Array.isArray(n)?vc(v(n)):null}function Ao(n){return typeof n!="string"?!1:bn.some(e=>e.name===n)}function hr(n){return typeof n!="string"?!1:["Less","LessEqual","Greater","GreaterEqual"].includes(n)}function xr(n){return typeof n!="string"?!1:["Equal","NotEqual"].includes(n)}var lt=["number","finite_number","complex","finite_complex","imaginary","real","finite_real","rational","finite_rational","integer","finite_integer","non_finite_number"],yr=["indexed_collection","list","tuple"],ct=[...yr,"collection","set","record","dictionary"],ft=["scalar",...lt,"boolean","string"],br=["value","color",...ct,...ft],Er=["expression","symbol","function",...br],Nr=["any","unknown","nothing","never","error",...Er],pt=new Set(lt),_o=new Set(ct),Ro=new Set(ft),Nn=new Set(Nr);function Sd(n){return typeof n!="string"?!1:Nn.has(n)}function Ti(n){return typeof n=="string"?Nn.has(n):typeof n!="object"||!("kind"in n)?!1:n.kind==="signature"||n.kind==="union"||n.kind==="intersection"||n.kind==="negation"||n.kind==="value"||n.kind==="tuple"||n.kind==="list"||n.kind==="record"||n.kind==="dictionary"||n.kind==="set"||n.kind==="symbol"||n.kind==="expression"||n.kind==="numeric"||n.kind==="collection"||n.kind==="indexed_collection"||n.kind==="reference"}var mt=class{input;pos=0;line=1;column=1;tokens=[];tolerant;constructor(e,i){this.input=e,this.tolerant=i?.tolerant??!1}saveState(){return{pos:this.pos,line:this.line,column:this.column,tokens:[...this.tokens]}}restoreState(e){this.pos=e.pos,this.line=e.line,this.column=e.column,this.tokens=e.tokens}error(e){throw new Error(`Lexer error at line ${this.line}, column ${this.column}: ${e}`)}peek(e=0){let i=this.pos+e;return i<this.input.length?this.input[i]:""}advance(){let e=this.input[this.pos++];return e===`
|
|
3
3
|
`?(this.line++,this.column=1):this.column++,e}match(e){if(this.input.slice(this.pos,this.pos+e.length)===e){for(let i=0;i<e.length;i++)this.advance();return!0}return!1}isEOF(){return this.pos>=this.input.length}skipWhitespace(){for(;!this.isEOF()&&/\s/.test(this.peek());)this.advance()}readIdentifier(){let e="";for(;!this.isEOF()&&/[a-zA-Z0-9_]/.test(this.peek());)e+=this.advance();return e}readVerbatimString(){if(!this.match("`"))return"";let e="";for(;!this.isEOF()&&this.peek()!=="`";)this.match("\\`")?e+="`":this.match("\\\\")?e+="\\":e+=this.advance();return this.isEOF()&&this.error("Unterminated verbatim string"),this.advance(),e}readStringLiteral(){let e=this.advance(),i="";for(;!this.isEOF()&&this.peek()!==e;)this.match("\\"+e)?i+=e:this.match("\\\\")?i+="\\":i+=this.advance();return this.isEOF()&&this.error("Unterminated string literal"),this.advance(),i}readNumber(){let e="";if((this.peek()==="-"||this.peek()==="+")&&(e+=this.advance()),this.match("0x")||this.match("0X")){for(e+="x";!this.isEOF()&&/[0-9a-fA-F]/.test(this.peek());)e+=this.advance();return"0"+e}if(this.match("0b")||this.match("0B")){for(e+="b";!this.isEOF()&&/[01]/.test(this.peek());)e+=this.advance();return"0"+e}for(;!this.isEOF()&&/[0-9]/.test(this.peek());)e+=this.advance();if(this.peek()==="."&&/[0-9]/.test(this.peek(1)))for(e+=this.advance();!this.isEOF()&&/[0-9]/.test(this.peek());)e+=this.advance();if(this.peek()==="e"||this.peek()==="E")for(e+=this.advance(),(this.peek()==="+"||this.peek()==="-")&&(e+=this.advance());!this.isEOF()&&/[0-9]/.test(this.peek());)e+=this.advance();return e}createToken(e,i){return{type:e,value:i,position:this.pos-i.length,line:this.line,column:this.column-i.length}}nextToken(){if(this.skipWhitespace(),this.isEOF())return this.createToken("EOF","");let e=this.pos,i=this.peek();if(this.match("->"))return this.createToken("->","->");if(this.match(".."))return this.createToken("..","..");if(this.match("+\u221E")||this.match("+oo"))return this.createToken("PLUS_INFINITY",this.input.slice(e,this.pos));if(this.match("-\u221E")||this.match("-oo"))return this.createToken("MINUS_INFINITY",this.input.slice(e,this.pos));if(this.match("+infinity"))return this.createToken("PLUS_INFINITY","+infinity");if(this.match("-infinity"))return this.createToken("MINUS_INFINITY","-infinity");if(/[a-zA-Z_]/.test(i)){let t=this.readIdentifier();switch(t){case"true":return this.createToken("TRUE",t);case"false":return this.createToken("FALSE",t);case"nan":return this.createToken("NAN",t);case"infinity":return this.createToken("INFINITY",t);case"oo":return this.createToken("INFINITY",t);default:return this.createToken("IDENTIFIER",t)}}switch(i){case"|":return this.advance(),this.createToken("|","|");case"&":return this.advance(),this.createToken("&","&");case"!":return this.advance(),this.createToken("!","!");case"^":return this.advance(),this.createToken("^","^");case"(":return this.advance(),this.createToken("(","(");case")":return this.advance(),this.createToken(")",")");case"<":return this.advance(),this.createToken("<","<");case">":return this.advance(),this.createToken(">",">");case"[":return this.advance(),this.createToken("[","[");case"]":return this.advance(),this.createToken("]","]");case",":return this.advance(),this.createToken(",",",");case":":return this.advance(),this.createToken(":",":");case"?":return this.advance(),this.createToken("?","?");case"*":return this.advance(),this.createToken("*","*");case"+":return/[0-9]/.test(this.peek(1))?this.createToken("NUMBER_LITERAL",this.readNumber()):(this.advance(),this.createToken("+","+"));case"x":return/[0-9]/.test(this.peek(1))?(this.advance(),this.createToken("x","x")):(this.advance(),this.createToken("x","x"))}if(i==='"'||i==="'")return this.createToken("STRING_LITERAL",this.readStringLiteral());if(i==="`")return this.createToken("VERBATIM_STRING",this.readVerbatimString());if(/[0-9]/.test(i)||i==="-"&&/[0-9]/.test(this.peek(1))){let t=this.readNumber();return this.peek()==="x"&&/[0-9]/.test(this.peek(1)),this.createToken("NUMBER_LITERAL",t)}if(i==="\u221E")return this.advance(),this.createToken("INFINITY","\u221E");if(this.tolerant)return this.createToken("EOF","");this.error(`Unexpected character: ${i}`)}tokenize(){let e=[];for(;!this.isEOF();){let i=this.nextToken();if(i&&(e.push(i),i.type==="EOF"))break}return e}peekToken(){if(this.tokens.length===0){let e=this.nextToken();e&&this.tokens.push(e)}return this.tokens[0]||this.createToken("EOF","")}consumeToken(){if(this.tokens.length===0){let e=this.nextToken();if(e)return e}return this.tokens.shift()||this.createToken("EOF","")}matchToken(e){return this.peekToken().type===e?(this.consumeToken(),!0):!1}expectToken(e){let i=this.consumeToken();return i.type!==e&&this.error(`Expected ${e}, got ${i.type}`),i}};var dt=class{lexer;typeResolver;current;allowTrailing;_end=0;constructor(e,i){this.allowTrailing=i?.allowTrailing??!1,this.lexer=new mt(e,{tolerant:this.allowTrailing}),this.typeResolver=i?.typeResolver??{forward:()=>{},resolve:()=>{},get names(){return[]}},this.current=this.lexer.consumeToken()}get endOffset(){return this._end}error(e,i){this.errorAtToken(this.current,e,i)}errorAtToken(e,i,t){let r=this.lexer.input;this.allowTrailing&&(r=r.slice(0,e.position+e.value.length));let o=r.split(`
|
|
4
4
|
`)[e.line-1]||r,a=e.column,u=" ".repeat(Math.max(0,a-1))+"^",l=["","Invalid type",`| ${o}`,`| ${u}`,"|",`| ${i}`];t&&l.push(`| ${t}`),l.push("");let c=new Error(l.join(`
|
package/dist/compile.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Compute Engine 0.69.
|
|
1
|
+
/** Compute Engine 0.69.1 */
|
|
2
2
|
|
|
3
3
|
// src/common/interruptible.ts
|
|
4
4
|
var CancellationError = class extends Error {
|
|
@@ -36300,7 +36300,7 @@ var IntervalGLSLTarget = class extends GLSLTarget {
|
|
|
36300
36300
|
};
|
|
36301
36301
|
|
|
36302
36302
|
// src/compile.ts
|
|
36303
|
-
var version = "0.69.
|
|
36303
|
+
var version = "0.69.1";
|
|
36304
36304
|
export {
|
|
36305
36305
|
BaseCompiler,
|
|
36306
36306
|
GLSLTarget,
|
package/dist/compile.min.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Compute Engine 0.69.
|
|
1
|
+
/** Compute Engine 0.69.1 */
|
|
2
2
|
var Ze=class extends Error{cause;value;constructor({message:n,value:t,cause:i}={}){super(n??"Operation canceled"),t&&(this.value=t),this.cause=i,this.name="CancellationError"}};function yt(e){if(e!==void 0&&Date.now()>=e)throw new Ze({cause:"timeout",message:"Timeout exceeded"})}var mi;function di(){return mi}function hi(e,n){let t=mi;mi=e;try{return n()}finally{mi=t}}function Dr(e,n){let t=Date.now();for(;;){let{done:i,value:r}=e.next();if(i)return r;if(Date.now()-t>=n)throw new Ze({value:r,cause:"timeout",message:`Timeout exceeded (${n}ms)`})}}function Or(e,n,t={}){let{contract:i=.125,step:r=1,power:o=2,atol:s=1e-16,rtol:a=s>0?0:Math.sqrt(Number.EPSILON),maxeval:u=1e6,breaktol:l=2,deadline:c=di()}=t;return isFinite(n)?hi(c,()=>{let f=r,p=Math.pow(1/i,o),m=e(n+f),g=[m],y=1/0,E=1;for(;E<u;){yt(c),E+=1,f*=i,g.push(e(n+f));let N=p,w=1/0;for(let A=g.length-2;A>=0;A--){let C=g[A];g[A]=g[A+1]+(g[A+1]-g[A])/(N-1);let O=Math.abs(g[A]-C);w=Math.min(w,O),O<y&&(m=g[A],y=O),N*=p}if(w>l*y||!isFinite(w)||y<=Math.max(a*Math.abs(m),s))break}return[m,y]}):Or(f=>e(1/f),1/n,{rtol:a,atol:s,maxeval:u,contract:Math.abs(i)>1?1/i:i,step:1/r,power:o,deadline:c})}var ou=new Map,zp=1e5;function J(e){if(e<=zp){let n=ou.get(e);return n===void 0&&(n=10n**BigInt(e),ou.set(e,n)),n}return 10n**BigInt(e)}function Ye(e){if(e<0n&&(e=-e),e===0n)return 0;let n=0,t=1;for(;e>>BigInt(t)>0n;)t*=2;for(let i=t>>1;i>=1;i>>=1)e>>BigInt(i)>0n&&(n+=i,e>>=BigInt(i));return n+1}function au(e,n,t){return e*n>>BigInt(t)}function uu(e,n,t){return(e<<BigInt(t))/n}function yi(e,n){if(e===0n)return 0n;if(e<0n)throw new RangeError("fpsqrt: negative input");let t=e<<BigInt(n),i;if(n<Gp){i=Lr(t);let a;do a=i,i=(i+t/i)/2n;while(Ae(i-a)>1n)}else i=Br(t,Ye(t));let r=(i+t/i)/2n,o=Ae(i*i-t);return Ae(r*r-t)<o?r:i}function Lr(e){let n=Ye(e);if(n<=1023){let s=Math.sqrt(Number(e));if(Number.isFinite(s)&&s>=1)return BigInt(Math.floor(s))}let t=n-52,i=Number(e>>BigInt(t)),r=Math.sqrt(i);t&1&&(r*=Math.SQRT2);let o=BigInt(Math.round(r))<<BigInt(t>>1);return o>0n?o:1n}var lu=1024,Gp=640;function Br(e,n){if(n<lu){let o=Lr(e),s;do s=o,o=(o+e/o)/2n;while(Ae(o-s)>1n);for(;o*o>e;)o-=1n;for(;(o+1n)*(o+1n)<=e;)o+=1n;return o}let t=n>>2<<1,i=Br(e>>BigInt(t),n-t)<<BigInt(t>>1),r;do r=i,i=(i+e/i)/2n;while(Ae(i-r)>1n);for(;i*i>e;)i-=1n;for(;(i+1n)*(i+1n)<=e;)i+=1n;return i}function Ae(e){return e<0n?-e:e}function Yn(e){if(e===0n)return 1;if(e<0n&&(e=-e),e<0x20000000000000n){let i=Number(e);return i<1e8?i<1e4?i<100?i<10?1:2:i<1e3?3:4:i<1e6?i<1e5?5:6:i<1e7?7:8:i<1e12?i<1e10?i<1e9?9:10:i<1e11?11:12:i<1e14?i<1e13?13:14:i<1e15?15:16}let n=e.toString(16).length*4,t=Math.ceil(n*.30102999566398);for(;e<J(t-1);)t--;for(;e>=J(t);)t++;return t}var jp=.7;function Vr(e,n){if(e===0n)return 1n<<BigInt(n);let t=Math.round(jp*Math.sqrt(n)),i=t+8,r=n+i,o=BigInt(r),s=1n<<o,a=BigInt(i),u=e<<a,l=u<0n,c=l?-u:u,f=Math.max(0,Ye(c)-r+t);c>>=BigInt(f),u=l?-c:c;let p=s,m=u;p+=m;for(let g=2;m=(m*u>>o)/BigInt(g),m!==0n;g++)p+=m;for(let g=0;g<f;g++)p=p*p>>o;return p+(1n<<a-1n)>>a}var Up=4e4;function qr(e,n){let t=1n<<BigInt(n);if(e<=0n)throw new RangeError("fpln: input must be positive");return e===t?0n:n>=Up?Yp(e,n):Hp(e,n)}function Hp(e,n){let t=BigInt(n),i=1n<<t,r=52,o=n-r,s;if(o>0){let g=Number(e>>BigInt(o))/2**r;s=BigInt(Math.round(Math.log(g)*2**r))<<BigInt(o)}else{let g=Number(e)/Number(i);s=BigInt(Math.round(Math.log(g)*Number(i)))}let a=e*Vr(-s,n)>>t,l=(a-i<<t)/(a+i),c=l<0n?-l:l,f=c*c>>t,p=c,m=c;for(let g=3n;p=p*f>>t,p!==0n;g+=2n)m+=p/g;return s+(l<0n?-2n:2n)*m}var Sn=null;function Zp(e){if(Sn!==null){if(Sn.bits===e)return Sn.value;if(Sn.bits>e)return Sn.value>>BigInt(Sn.bits-e)}let n=Math.ceil(e*xi)+12,t;if(n<=su.length){let i=su.slice(0,n);t=(BigInt(i)<<BigInt(e))/J(i.length)}else t=nm(e);return Sn={bits:e,value:t},t}function Yp(e,n){let t=BigInt(n),i=Ye(e)-n,r=Math.max(2,Math.ceil(n/2+4-i)),o=e<<BigInt(r-2),s=1n<<t,a=o;for(;Ae(s-a)>1n;){let l=s+a>>1n;a=vt(s*a),s=l}return bi(n)*o/(2n*s)-BigInt(r)*Zp(n)}var Zn="314159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316527120190914564856692346034861045432664821339360726024914127372458700660631558817488152092096282925409171536436789259036001133053054882046652138414695194151160943305727036575959195309218611738193261179310511854807446237996274956735188575272489122793818301194912983367336244065664308602139494639522473719070217986094370277053921717629317675238467481846766940513200056812714526356082778577134275778960917363717872146844090122495343014654958537105079227968925892354201995611212902196086403441815981362977477130996051870721134999999837297804995105973173281609631859502445945534690830264252230825334468503526193118817101000313783875288658753320838142061717766914730359825349042875546873115956286388235378759375195778185778053217122680661300192787661119590921642019893809525720106548586327886593615338182796823030195203530185296899577362259941389124972177528347913151557485724245415069595082953311686172785588907509838175463746493931925506040092770167113900984882401285836160356370766010471018194295559619894676783744944825537977472684710404753464620804668425906949129331367702898915210475216205696602405803815019351125338243003558764024749647326391419927260426992279678235478163600934172164121992458631503028618297455570674983850549458858692699569092721079750930295532116534498720275596023648066549911988183479775356636980742654252786255181841757467289097777279380008164706001614524919217321721477235014144197356854816136115735255213347574184946843852332390739414333454776241686251898356948556209921922218427255025425688767179049460165346680498862723279178608578438382796797668145410095388378636095068006422512520511739298489608412848862694560424196528502221066118630674427862203919494504712371378696095636437191728746776465757396241389086583264599581339047802759009946576407895126946839835259570982582262052248940772671947826848260147699090264013639443745530506820349625245174939965143142980919065925093722169646151570985838741059788595977297549893016175392846813826868386894277415599185592524595395943104997252468084598727364469584865383673622262609912460805124388439045124413654976278079771569143599770012961608944169486855584840635",xi=Math.log10(2),su="693147180559945309417232121458176568075500134360255254120680009493393621969694715605863326996418687542001481020570685733685520235758130557032670751635075961930727570828371435190307038623891673471123350115364497955239120475172681574932065155524734139525882950453007095326366642654104239157814952043740430385500801944170641671518644712839968171784546957026271631064546150257207402481637773389638550695260668341137273873722928956493547025762652098859693201965058554764703306793654432547632744951250406069438147104689946506220167720424524529612687946546193165174681392672504103802546259656869144192871608293803172714367782654877566485085674077648451464439940461422603193096735402574446070308096085047486638523138181676751438667476647890881437141985494231519973548803751658612753529166100071053558249879414729509293113897155998205654392871700072180857610252368892132449713893203784393530887748259701715591070882368362758984258918535302436342143670611892367891923723146723217205340164925687274778234453534764811494186423867767744060695626573796008670762571991847340226514628379048830620330611446300737194890027436439650025809365194430411911506080948793067865158870900605203468429736193841289652556539686022194122924207574321757489097706752687115817051137009158942665478595964890653058460258668382940022833005382074005677053046787001841624044188332327983863490015631218895606505531512721993983320307514084260914790012651682434438935724727882054862715527418772430024897945401961872339808608316648114909306675193393128904316413706813977764981769748689038877899912965036192707108892641052309247839173735012298424204995689359922066022046549415106139187885744245577510206837030866619480896412186807790208181588580001688115973056186676199187395200766719214592236720602539595436541655311295175989940056000366513567569051245926825743946483168332624901803824240824231452306140963805700702551387702681785163069025513703234053802145019015374029509942262995779647427138157363801729873940704242179972266962979939312706935747240493386530879758721699645129446491883771156701678598804981838896784134938314014073166472765327635919233511233389338709513209059272185471328975470797891384445466676192702885533423429899321803769154973340267546758873236778342916191810430116091695265547859732891763545556742863877463987101912431754255888301206779210280341206879759143081283307230300883494705792496591005860012341561757413272465943",Wp=13591409n,Xp=545140134n,Qp=10939058860032000n,Kp=47.11;function gi(e,n){if(n-e===1){let l,c;if(e===0)l=1n,c=1n;else{l=BigInt(6*e-5)*BigInt(2*e-1)*BigInt(6*e-1);let p=BigInt(e);c=p*p*p*Qp}let f=l*(Wp+Xp*BigInt(e));return e&1&&(f=-f),[l,c,f]}let t=e+n>>1,[i,r,o]=gi(e,t),[s,a,u]=gi(t,n);return[i*s,r*a,a*o+i*u]}function cu(e){return Math.max(2,Math.floor(e/Kp)+3)}function em(e){let[,n,t]=gi(0,cu(e)),i=1n<<BigInt(e),r=vt(10005n*i*i);return n*426880n*r/t}function fu(e){let[,n,t]=gi(0,cu(Math.ceil(e/xi))),i=J(e),r=vt(10005n*i*i);return n*426880n*r/t}function Fr(e,n){if(n-e===1){let l=e===0?1n:BigInt(2*e-1),c=e===0?1n:9n*BigInt(2*e+1);return[l,c,l]}let t=e+n>>1,[i,r,o]=Fr(e,t),[s,a,u]=Fr(t,n);return[i*s,r*a,a*o+i*u]}function nm(e){let n=Math.max(2,Math.ceil(e/3.169925)+5),[,t,i]=Fr(0,n);return(i<<BigInt(e+1))/(3n*t)}function vt(e){if(e<0n)throw new RangeError("bigintSqrt: negative input");if(e===0n)return 0n;let n=Ye(e);if(n>=lu)return Br(e,n);let t=Lr(e),i;do i=t,t=(t+e/t)/2n;while(Ae(t-i)>1n);for(;t*t>e;)t-=1n;for(;(t+1n)*(t+1n)<=e;)t+=1n;return t}var wn=null;function bi(e){if(wn!==null){if(wn.bits===e)return wn.value;if(wn.bits>e)return wn.value>>BigInt(wn.bits-e)}let n=tm(e);return wn={bits:e,value:n},n}function tm(e){let n=Math.ceil(e*xi)+12;if(n+1<=Zn.length){let t=Zn.slice(0,n+1);return(BigInt(t)<<BigInt(e))/J(t.length-1)}return em(e)}function vi(e,n){let t=BigInt(n),i=1n<<t;if(e===0n)return[0n,i];let r=bi(n),o=2n*r,s=r/2n,a,u=Ae(e);if(u>i<<30n){let O=Ye(u)-n+64,B=n+O,K=e<<BigInt(O),ie=2n*bi(B),V=K%ie;V<0n&&(V+=ie),a=V>>BigInt(O)}else a=e%o;a<0n&&(a+=o);let l=1n,c=1n;a>3n*s?(a=o-a,l=-1n):a>r?(a=a-r,l=-1n,c=-1n):a>s&&(a=r-a,c=-1n);let f=Math.round(n*xi),p=Math.min(18,Math.max(2,Math.ceil(.87*Math.sqrt(f)))),m=0,g=i>>BigInt(p);for(;a>g;)a=a/2n,m++;let y=a,E=i,N=a,w=i,A=a*a,C=2n*t;for(let O=2;;O+=2){if(w=(w*A>>C)/(BigInt(O)*BigInt(O-1)),w===0n){N=(N*A>>C)/(BigInt(O+1)*BigInt(O)),N!==0n&&(O%4===2?(E-=w,y-=N):(E+=w,y+=N));break}if(N=(N*A>>C)/(BigInt(O+1)*BigInt(O)),O%4===2?(E-=w,y-=N):(E+=w,y+=N),N===0n)break}for(let O=0;O<m;O++){let B=2n*y*E>>t,K=(2n*E*E>>t)-i;y=B,E=K}return[l*y,c*E]}function xt(e,n){if(e===0n)return 0n;if(e<0n)return-xt(-e,n);let t=BigInt(n),i=1n<<t,o=bi(n)/2n;if(e>i){let m=(i<<t)/e;return o-xt(m,n)}let s=4n*i/10n,a=0,u=e;for(;u>s;){let m=u*u,g=(i<<t)+m>>t,y=yi(g,n);u=(u<<t)/(i+y),a++}let l=u,c=u,f=u*u,p=2n*t;for(let m=3;c=c*f>>p,c!==0n;m+=2)m%4===3?l-=c/BigInt(m):l+=c/BigInt(m);for(let m=0;m<a;m++)l=2n*l;return l}var Jr=NaN,h=class e{static precision=50;static ZERO=Object.freeze(Object.assign(Object.create(e.prototype),{_digits:1,significand:0n,exponent:0}));static ONE=Object.freeze(Object.assign(Object.create(e.prototype),{_digits:1,significand:1n,exponent:0}));static TWO=Object.freeze(Object.assign(Object.create(e.prototype),{_digits:1,significand:2n,exponent:0}));static NEGATIVE_ONE=Object.freeze(Object.assign(Object.create(e.prototype),{_digits:1,significand:-1n,exponent:0}));static HALF=Object.freeze(Object.assign(Object.create(e.prototype),{_digits:1,significand:5n,exponent:-1}));static NAN=Object.freeze(Object.assign(Object.create(e.prototype),{_digits:1,significand:0n,exponent:NaN}));static POSITIVE_INFINITY=Object.freeze(Object.assign(Object.create(e.prototype),{_digits:1,significand:1n,exponent:1/0}));static NEGATIVE_INFINITY=Object.freeze(Object.assign(Object.create(e.prototype),{_digits:1,significand:-1n,exponent:1/0}));static _piFullPrecision=null;static _piCache=null;static _piCachePrecision=0;static _eulerGammaCache=null;static _eulerGammaCachePrecision=0;static get PI(){let n=e.precision;if(e._piCache!==null&&e._piCachePrecision===n)return e._piCache;let t=n+4,i;if(t+1<=Zn.length)e._piFullPrecision===null&&(e._piFullPrecision=new e(Zn[0]+"."+Zn.slice(1))),i=e._piFullPrecision.toPrecision(t);else{let r=t+4;i=z(fu(r),-r).toPrecision(t)}return e._piCache=i,e._piCachePrecision=n,i}static get EULER_GAMMA(){let n=e.precision;if(e._eulerGammaCache!==null&&e._eulerGammaCachePrecision>=n)return e._eulerGammaCache.toPrecision(n);let t=om(n);return e._eulerGammaCache=t,e._eulerGammaCachePrecision=n,t}significand;exponent;_digits;digitCount(){return this._digits??(this._digits=Yn(this.significand))}constructor(n){if(n instanceof e){this.significand=n.significand,this.exponent=n.exponent;return}if(typeof n=="bigint"){[this.significand,this.exponent]=Ei(n,0);return}if(typeof n=="number"){[this.significand,this.exponent]=sm(n);return}[this.significand,this.exponent]=gu(n)}isNaN(){return Number.isNaN(this.exponent)}isZero(){return this.exponent===0&&this.significand===0n}isFinite(){return Number.isFinite(this.exponent)}isInteger(){return this.isFinite()&&this.exponent>=0}isPositive(){return this.significand>0n}isNegative(){return this.significand<0n}cmp(n){if(typeof n=="number"){if(Number.isNaN(n))return Jr;let m=this.exponent;if(Number.isNaN(m))return Jr;if(n===0)return this.significand===0n?0:this.significand>0n?1:-1;if(!Number.isFinite(m))return n===1/0?this.significand>0n?0:-1:n===-1/0?this.significand<0n?0:1:this.significand>0n?1:-1;if(this.significand===0n)return n>0?-1:1;if(n===1/0)return-1;if(n===-1/0)return 1;if(this.significand>0n!=n>0)return this.significand>0n?1:-1;if(Number.isInteger(n)&&m>=0&&m<=15){let g=this.significand*J(m),y=BigInt(n);return g<y?-1:g>y?1:0}n=new e(n)}let t=this.exponent,i=n.exponent,r=this.significand,o=n.significand;if(t!==t||i!==i)return Jr;if(!Number.isFinite(t)||!Number.isFinite(i))return!Number.isFinite(t)&&!Number.isFinite(i)?r===o?0:r>o?1:-1:Number.isFinite(t)?o>0n?-1:1:r>0n?1:-1;if(r===0n)return o===0n?0:o>0n?-1:1;if(o===0n)return r>0n?1:-1;if(r>0n&&o<0n)return 1;if(r<0n&&o>0n)return-1;if(t===i)return r<o?-1:r>o?1:0;let s=this.digitCount(),a=n.digitCount(),u=s+t,l=a+i;if(u!==l){let m=r>0n?1:-1;return u>l?m:-m}let c=r,f=o,p=Math.abs(t-i);if(p>1e3){let m=s,g=a,y=Math.max(m,g)+1;m<y&&(c=c*J(y-m)),g<y&&(f=f*J(y-g))}else t<i?f=f*J(p):c=c*J(p);return c<f?-1:c>f?1:0}eq(n){return typeof n=="number"?n===0?this.significand===0n&&this.exponent===0:n===1?this.significand===1n&&this.exponent===0:n===-1?this.significand===-1n&&this.exponent===0:Number.isInteger(n)&&Number.isFinite(this.exponent)&&this.exponent>=0&&this.exponent<=15?this.significand*J(this.exponent)===BigInt(n):this.cmp(n)===0:this.significand===n.significand&&this.exponent===n.exponent}lt(n){return this.cmp(n)===-1}lte(n){let t=this.cmp(n);return t===-1||t===0}gt(n){return this.cmp(n)===1}gte(n){let t=this.cmp(n);return t===1||t===0}add(n){typeof n=="number"&&(n=new e(n));let t=this.exponent,i=n.exponent;if(Number.isFinite(t)&&Number.isFinite(i)){if(t===i)return z(this.significand+n.significand,t);let s=t-i;return s>0?z(this.significand*J(s)+n.significand,i):z(this.significand+n.significand*J(-s),t)}if(t!==t||i!==i)return e.NAN;let r=!Number.isFinite(t),o=!Number.isFinite(i);return r&&o?this.significand!==n.significand?e.NAN:this.significand>0n?e.POSITIVE_INFINITY:e.NEGATIVE_INFINITY:r?this.significand>0n?e.POSITIVE_INFINITY:e.NEGATIVE_INFINITY:n.significand>0n?e.POSITIVE_INFINITY:e.NEGATIVE_INFINITY}sub(n){typeof n=="number"&&(n=new e(n));let t=this.exponent,i=n.exponent;if(Number.isFinite(t)&&Number.isFinite(i)){if(t===i)return z(this.significand-n.significand,t);let s=t-i;return s>0?z(this.significand*J(s)-n.significand,i):z(this.significand-n.significand*J(-s),t)}if(t!==t||i!==i)return e.NAN;let r=!Number.isFinite(t),o=!Number.isFinite(i);return r&&o?this.significand===n.significand?e.NAN:this.significand>0n?e.POSITIVE_INFINITY:e.NEGATIVE_INFINITY:r?this.significand>0n?e.POSITIVE_INFINITY:e.NEGATIVE_INFINITY:n.significand>0n?e.NEGATIVE_INFINITY:e.POSITIVE_INFINITY}mul(n){typeof n=="number"&&(n=new e(n));let t=this.exponent,i=n.exponent;if(Number.isFinite(t)&&Number.isFinite(i))return z(this.significand*n.significand,t+i);if(t!==t||i!==i||this.significand===0n||n.significand===0n)return e.NAN;let r=this.significand>0n?1n:-1n,o=n.significand>0n?1n:-1n;return r*o>0n?e.POSITIVE_INFINITY:e.NEGATIVE_INFINITY}mulToPrecision(n,t){typeof n=="number"&&(n=new e(n));let i=this.exponent,r=n.exponent,o=this.significand,s=n.significand;if(o!==0n&&s!==0n&&Number.isFinite(i)&&Number.isFinite(r)){let a=o*s,u=i+r,l=this.digitCount()+n.digitCount()-1,f=(a<0n?-a:a)>=J(l)?l+1:l;return f<=t?z(a,u):pu(a,u).roundToPrecKnownDigits(t,f)}return this.mul(n).toPrecision(t)}neg(){let n=this.significand;return n===0n?this:Number.isFinite(this.exponent)?z(-n,this.exponent):n>0n?e.NEGATIVE_INFINITY:e.POSITIVE_INFINITY}abs(){return this.significand>=0n?this:Number.isFinite(this.exponent)?z(-this.significand,this.exponent):e.POSITIVE_INFINITY}floor(){let n=this.exponent;if(n>=0)return this;if(Number.isFinite(n)){let t=this.trunc();return this.significand<0n?t.sub(z(1n,0)):t}return this}ceil(){let n=this.exponent;if(n>=0)return this;if(Number.isFinite(n)){let t=this.trunc();return this.significand>0n?t.add(z(1n,0)):t}return this}round(){let n=this.exponent;if(n>=0)return this;if(Number.isFinite(n)){let t=z(5n,-1);return this.significand>0n?this.add(t).trunc():this.sub(t).trunc()}return this}trunc(){let n=this.exponent;if(n>=0)return this;if(Number.isFinite(n)){let t=this.significand/J(-n);return z(t===0n?0n:t,0)}return this}div(n){typeof n=="number"&&(n=new e(n));let t=this.exponent,i=n.exponent,r=this.significand,o=n.significand;if(Number.isFinite(t)&&Number.isFinite(i)){if(o===0n)return r===0n?e.NAN:r>0n?e.POSITIVE_INFINITY:e.NEGATIVE_INFINITY;if(r===0n)return z(0n,0);let u=e.precision,l=10,c=this.digitCount(),f=n.digitCount(),p=u+l+Math.max(0,f-c),m=J(p),g=r*m/o,y=t-i-p,E=g<0n?-g:g,N=c+p-f,w=E>=J(N)?N+1:N;return pu(g,y).roundToPrecKnownDigits(u,w)}if(t!==t||i!==i)return e.NAN;let s=!Number.isFinite(t),a=!Number.isFinite(i);if(s&&a)return e.NAN;if(s){let u=r>0n?1n:-1n,l=o>0n?1n:o<0n?-1n:1n;return u*l>0n?e.POSITIVE_INFINITY:e.NEGATIVE_INFINITY}return z(0n,0)}inv(){return z(1n,0).div(this)}divToward(n,t){typeof n=="number"&&(n=new e(n));let i=this.exponent,r=n.exponent,o=this.significand,s=n.significand;if(!Number.isFinite(i)||!Number.isFinite(r)||s===0n||o===0n)return this.div(n);let a=o<0n!=s<0n,u=o<0n?-o:o,l=s<0n?-s:s,c=e.precision,p=c+10+Math.max(0,n.digitCount()-this.digitCount()),m=u*J(p),g=m/l,y=m%l!==0n,E=i-r-p,N=this.digitCount()+p-n.digitCount(),w=g>=J(N)?N+1:N,A=a?t==="floor":t==="ceiling",[C,O]=mu(g,y,E,c,A,w);return z(a?-C:C,O)}sqrtToward(n){if(this.significand===0n)return this.exponent!==this.exponent?this:e.ZERO;if(!Number.isFinite(this.exponent))return this.significand>0n?e.POSITIVE_INFINITY:e.NAN;if(this.significand<0n)return e.NAN;let t=e.precision,i=4,r=this.significand,o=this.exponent,s=o+this.digitCount()-1,a=Math.floor(s/2),u=t+i-a;o+2*u<0&&(u=Math.ceil(-o/2)+1);let l=o+2*u,c=l>=0?r*J(l):r/J(-l),f=vt(c),p=f*f!==c,[m,g]=mu(f,p,-u,t,n==="ceiling");return z(m,g)}mod(n){typeof n=="number"&&(n=new e(n));let t=this.exponent,i=n.exponent;if(Number.isFinite(t)&&Number.isFinite(i)){if(n.significand===0n)return e.NAN;if(this.significand===0n)return z(0n,0);let r=t-i,o=r>=0?this.significand*J(r):this.significand,s=r>=0?n.significand:n.significand*J(-r),a=o/s;return this.sub(z(a,0).mul(n))}return t!==t||i!==i||!Number.isFinite(t)?e.NAN:new e(this)}pow(n){if(typeof n=="number"&&(n=new e(n)),this.isNaN()||n.isNaN()||!n.isFinite())return e.NAN;if(n.isInteger()){let a=n.toBigInt();if(a===0n)return z(1n,0);if(!this.isFinite())return a>0n?this.significand<0n&&a%2n!==0n?e.NEGATIVE_INFINITY:e.POSITIVE_INFINITY:z(0n,0);if(this.isZero())return a>0n?z(0n,0):e.POSITIVE_INFINITY;if(a<0n)return this.pow(n.neg()).inv();let u=this.significand<0n?-this.significand:this.significand,l=this.digitCount(),c=l>15?l-15:0,f=c>0?Number(u/10n**BigInt(c)):Number(u),p=Math.log10(f)+c+this.exponent,m=Number(a)*p;if(m>9e15)return this.significand<0n&&a%2n!==0n?e.NEGATIVE_INFINITY:e.POSITIVE_INFINITY;if(m<-9e15)return z(0n,0);let g=e.precision,y=a.toString(2).length,E=Math.min(2*y+5,100),N=g+E,w=z(1n,0),A=this,C=a;for(;C>0n;)C&1n&&(w=w.mulToPrecision(A,N)),C>>=1n,C>0n&&(A=A.mulToPrecision(A,N));return w.toPrecision(g)}if(!this.isFinite())return this.significand<0n?e.NAN:n.significand>0n?e.POSITIVE_INFINITY:e.ZERO;if(this.isZero())return n.significand>0n?e.ZERO:e.POSITIVE_INFINITY;if(this.significand<0n)return e.NAN;let t=this.exponent+this.digitCount()-1,r=n.exponent+n.digitCount()-1+Math.log10(Math.abs(t)*2.303+3)+1,o=Math.min(20,Math.max(2,Math.ceil(r)+2)),s=e.precision;e.precision=s+o;try{let a=rm(this,s+o);return n.mul(a).exp().toPrecision(s)}finally{e.precision=s}}toNumber(){return Number.isFinite(this.exponent)?this.significand===0n?0:this.exponent===0?Number(this.significand):Number(this.toString()):this.exponent!==this.exponent?NaN:this.significand>0n?1/0:-1/0}toString(){if(!Number.isFinite(this.exponent))return this.exponent!==this.exponent?"NaN":this.significand>0n?"Infinity":"-Infinity";if(this.significand===0n)return"0";let n=this.significand<0n,t=(n?-this.significand:this.significand).toString(),i=t.length,r=i+this.exponent-1,o=n?"-":"";if(r>20||r<-6){let u=i===1?t:t[0]+"."+t.slice(1),l=r>=0?"+":"";return`${o}${u}e${l}${r}`}if(this.exponent>=0)return o+t+"0".repeat(this.exponent);let s=-this.exponent;if(s<i){let u=t.slice(0,i-s),l=t.slice(i-s);return`${o}${u}.${l}`}let a=s-i;return`${o}0.${"0".repeat(a)}${t}`}toFixed(n){let t=n??0;if(!Number.isFinite(this.exponent))return this.exponent!==this.exponent?"NaN":this.significand>0n?"Infinity":"-Infinity";let i=this.significand<0n,r=i?-this.significand:this.significand,o=this.exponent+t,s,a;if(o>=0)a=r===0n,s=a?"0":r.toString()+"0".repeat(o);else{let f=J(-o),p=r/f,m=r%f,g=f/2n,y;m>g?y=p+1n:m<g||f%2n!==0n||p%2n===0n?y=p:y=p+1n,a=y===0n,s=y.toString()}let u=i&&!a?"-":"";if(t===0)return`${u}${s}`;if(s.length<=t){let f=s.padStart(t,"0");return`${u}0.${f}`}let l=s.slice(0,s.length-t),c=s.slice(s.length-t);return`${u}${l}.${c}`}toPrecision(n){if(this.significand===0n||!Number.isFinite(this.exponent))return this;let t=this.digitCount();return t<=n?this:this.roundToPrecKnownDigits(n,t)}roundToPrecKnownDigits(n,t){let i=this.significand<0n?-this.significand:this.significand,r=t-n,o=J(r),s=i/o,a=i-s*o,u=o/2n;(a>u||a===u&&s%2n!==0n)&&(s+=1n);let l=this.significand<0n?-s:s;return z(l,this.exponent+r)}toBigInt(){if(!Number.isFinite(this.exponent))throw this.exponent!==this.exponent?new RangeError("Cannot convert NaN to BigInt"):new RangeError("Cannot convert Infinity to BigInt");if(this.exponent>=0)return this.significand*J(this.exponent);let n=J(-this.exponent);return this.significand/n}},im=8,Et=[];function rm(e,n){let t=e.significand,i=e.exponent;for(let o=Et.length-1;o>=0;o--){let s=Et[o];if(s.prec===n&&s.exp===i&&s.sig===t)return s.ln}let r=e.ln();return Et.push({sig:t,exp:i,prec:n,ln:r}),Et.length>im&&Et.shift(),r}function om(e){let n=e+20+Math.ceil(Math.log10(e+10)),t=h.precision;h.precision=n;try{let i=Math.ceil(n*Math.LN10/4)+5,r=new h(i),o=r.mul(r),s=h.ONE,a=h.ONE,u=h.ZERO,l=h.ZERO,c=h.ONE.div(new h(10).pow(n)),f=6*i+100;for(let p=1;p<=f;p++){let m=new h(p).mul(p);if(s=s.mul(o).div(m).toPrecision(n),l=l.add(h.ONE.div(p)).toPrecision(n),a=a.add(s).toPrecision(n),u=u.add(s.mul(l)).toPrecision(n),p>i&&s.lt(a.mul(c)))break}return u.div(a).sub(r.ln()).toPrecision(e)}finally{h.precision=t}}function z(e,n){let[t,i]=Ei(e,n),r=Object.create(h.prototype);return r.significand=t,r.exponent=i,r}function pu(e,n){let t=Object.create(h.prototype);return t.significand=e,t.exponent=n,t}function mu(e,n,t,i,r,o){if(e===0n)return[r&&n?1n:0n,t];let s=o??Yn(e);if(s<=i)return[r&&n?e+1n:e,t];let a=s-i,u=J(a),l=e/u,c=n||e%u!==0n;return r&&c&&(l+=1n),[l,t+a]}var du=1000000000n,hu=1000n;function Ei(e,n){if(e===0n)return[0n,0];if((e&1n)!==0n)return[e,n];if(e%10n!==0n)return[e,n];for(;e%du===0n;)e/=du,n+=9;for(;e%hu===0n;)e/=hu,n+=3;for(;e%10n===0n;)e/=10n,n+=1;return[e,n]}function sm(e){return Number.isNaN(e)?[0n,NaN]:e===1/0?[1n,1/0]:e===-1/0?[-1n,1/0]:Number.isInteger(e)?Ei(BigInt(e),0):gu(e.toString())}function gu(e){if(e=e.trim(),e===""||e==="NaN")return[0n,NaN];if(e==="Infinity"||e==="+Infinity")return[1n,1/0];if(e==="-Infinity")return[-1n,1/0];let n,t=0,i=e.search(/[eE]/);if(i!==-1){if(n=e.slice(0,i),t=Number(e.slice(i+1)),!Number.isFinite(t))return[0n,NaN]}else n=e;let r=!1;n.startsWith("-")?(r=!0,n=n.slice(1)):n.startsWith("+")&&(n=n.slice(1));let o=n.indexOf("."),s,a;o===-1?(s=n,a=""):(s=n.slice(0,o),a=n.slice(o+1)),s=s.replace(/^0+/,"")||"0";let u=s+a;if(u.length===0||!/^\d+$/.test(u))return[0n,NaN];let l=BigInt(u);r&&(l=-l);let c=-a.length;return Ei(l,c+t)}var am=Math.log2(10),xu=Math.log10(2),um=16,Gr=1e6;function We(e,n){let t=Math.ceil(n*am)+um,i=BigInt(t);return e.exponent>=0?[e.significand*J(e.exponent)<<i,t]:[(e.significand<<i)/J(-e.exponent),t]}function Xe(e,n,t){if(e===0n)return h.ZERO;let i=e<0n,r=i?-e:e,o=BigInt(n),s=Ye(r)-n,a=Math.floor(s*xu),u=t+4-a,l,c;if(u>=0)l=r*J(u)+(1n<<o-1n)>>o,c=-u;else{let p=J(-u)<<o;l=(r+p/2n)/p,c=-u}if(l===0n)return h.ZERO;let f=Yn(l);if(f>t){let p=f-t,m=J(p),g=m/2n,y=l%m;l=l/m,y>=g&&(l+=1n),c+=p}return z(i?-l:l,c)}function ge(e){return e.exponent+e.digitCount()-1}function zr(e,n){if(e===0n)return 0;let t=e<0n?-e:e,i=n*xu-(Yn(t)-1);return i>0?Math.ceil(i):0}var vu=5,bu=BigInt(Number.MAX_SAFE_INTEGER),Mn=null;function Eu(e){if(Mn!==null){if(Mn.bits===e)return Mn.value;if(Mn.bits>e)return Mn.value>>BigInt(Mn.bits-e)}let n=qr(10n<<BigInt(e),e);return Mn={bits:e,value:n},n}h.prototype.sqrt=function(){if(this.isNaN())return h.NAN;if(this.isZero())return h.ZERO;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:h.NAN;if(this.significand<0n)return h.NAN;let e=h.precision,n=e+10,t=ge(this),i=Math.floor(t/2),r=z(this.significand,this.exponent-2*i),[o,s]=We(r,n),a=yi(o,s),u=Xe(a,s,e);return z(u.significand,u.exponent+i)};h.prototype.cbrt=function(){if(this.isNaN())return h.NAN;if(this.isZero())return h.ZERO;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:h.NEGATIVE_INFINITY;if(this.significand<0n)return this.neg().cbrt().neg();let e=h.precision,n=e+10,t=ge(this),i=Math.floor(t/3),r=z(this.significand,this.exponent-3*i),[o,s]=We(r,n),a=o<<BigInt(2*s),u,l=r.toNumber();if(s<=1e3&&Number.isFinite(l)&&l>0){let p=Number(1n<<BigInt(s)),m=Math.cbrt(l);Number.isFinite(m)&&m>0?(u=BigInt(Math.floor(m*p)),u===0n&&(u=1n)):u=yu(a)}else u=yu(a);let c;do{c=u;let p=u*u;if(p===0n){u=1n;break}u=(2n*u+a/p)/3n}while(Ae(u-c)>1n);{let p=(2n*u+a/(u*u))/3n,m=Ae(u*u*u-a);Ae(p*p*p-a)<m&&(u=p)}let f=Xe(u,s,e);return z(f.significand,f.exponent+i)};h.sqrt=function(e){return e.sqrt()};h.cbrt=function(e){return e.cbrt()};h.prototype.exp=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:h.ZERO;if(this.isZero())return h.ONE;if(ge(this)>=17)return this.significand>0n?h.POSITIVE_INFINITY:h.ZERO;let e=h.precision,n=Math.max(0,this.exponent+this.digitCount()),t=e+20+n,[i,r]=We(this,t),o=Eu(r),s=i/o,a=i-s*o;if(a<0n&&(s-=1n,a+=o),s>bu||s<-bu)return s>0n?h.POSITIVE_INFINITY:h.ZERO;let u=Xe(Vr(a,r),r,e),l=u.exponent+Number(s);return Number.isSafeInteger(l)?z(u.significand,l):s>0n?h.POSITIVE_INFINITY:h.ZERO};h.prototype.ln=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:h.NAN;if(this.isZero())return h.NEGATIVE_INFINITY;if(this.significand<0n)return h.NAN;if(this.eq(1))return h.ZERO;let e=h.precision,n=this.significand,t=this.digitCount(),i=this.exponent+t-1,r=z(n,-(t-1)),o=Math.abs(i).toString().length,s=0;if(i===0||i===-1){let p=this.sub(h.ONE);if(!p.isZero()){let m=ge(p);m<0&&(s=-m)}}let a=e+20+o+s,[u,l]=We(r,a),c=Eu(l),f=qr(u,l)+BigInt(i)*c;return Xe(f,l,e)};h.prototype.log=function(e){let n=e instanceof h?e:new h(e),t=h.precision;h.precision=t+10;try{return this.ln().div(n.ln()).toPrecision(t)}finally{h.precision=t}};h.exp=function(e){return e.exp()};h.ln=function(e){return e.ln()};h.log10=function(e){return e.log(10)};h.log2=function(e){return e.log(2)};h.prototype.sin=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return h.NAN;if(this.isZero())return h.ZERO;let e=h.precision,n=ge(this);if(n<0&&-2*n>=e+4)return this.toPrecision(e);let t=e+15+(n<0?-n:0);if(n+t+30>Gr)return h.NAN;let[i,r]=We(this,t),[o]=vi(i,r);return Xe(o,r,e)};h.prototype.cos=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return h.NAN;if(this.isZero())return h.ONE;let e=h.precision,n=ge(this),t=0;for(let i=0;;i++){let r=e+15+t;if(n+r+30>Gr)return h.NAN;let[o,s]=We(this,r),[,a]=vi(o,s);if(a===0n){if(i>=3)return h.ZERO;t+=e+30;continue}let u=zr(a,s);if(u<=t+vu||i>=3)return Xe(a,s,e);t=u+5}};h.prototype.tan=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return h.NAN;if(this.isZero())return h.ZERO;let e=h.precision,n=ge(this);if(n<0&&-2*n>=e+4)return this.toPrecision(e);let t=n<0?-n:0,i=0;for(let r=0;;r++){let o=e+15+t+i;if(n+o+30>Gr)return h.NAN;let[s,a]=We(this,o),[u,l]=vi(s,a);if(l===0n){if(r>=3)return u>0n?h.POSITIVE_INFINITY:h.NEGATIVE_INFINITY;i+=e+30;continue}let c=Math.max(u===0n?0:zr(u,a),zr(l,a));if(c<=i+vu||r>=3){let f=(u<<BigInt(a))/l;return Xe(f,a,e)}i=c+5}};h.prototype.atan=function(){if(this.isNaN())return h.NAN;if(this.isZero())return h.ZERO;if(!this.isFinite()){let s=h.PI.div(h.TWO);return this.significand>0n?s:s.neg()}let e=h.precision,n=ge(this);if(n<0&&-2*n>=e+4)return this.toPrecision(e);let t=e+15+(n<0?-n:0),[i,r]=We(this,t),o=xt(i,r);return Xe(o,r,e)};h.prototype.asin=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return h.NAN;if(this.isZero())return h.ZERO;let e=this.abs(),n=h.ONE;if(e.gt(n))return h.NAN;if(e.eq(n)){let m=h.PI.div(h.TWO);return this.significand>0n?m:m.neg()}let t=h.precision,i=ge(this);if(i<0&&-2*i>=t+4)return this.toPrecision(t);let r=t+20+(i<0?-i:0),[o,s]=We(this,r),a=1n<<BigInt(s),u=au(o,o,s),l=a-u,c=yi(l,s),f=uu(o,c,s),p=xt(f,s);return Xe(p,s,t)};h.prototype.acos=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return h.NAN;if(this.abs().gt(h.ONE))return h.NAN;if(this.eq(1))return h.ZERO;if(this.eq(-1))return h.PI;let n=h.precision,t=h.precision;h.precision=n+10;try{let i=h.TWO;if(this.significand>=0n){let o=h.ONE.sub(this).mulToPrecision(h.HALF,n+10).sqrt();return i.mulToPrecision(o.asin(),n)}let r=h.ONE.add(this).mulToPrecision(h.HALF,n+10).sqrt();return h.PI.sub(i.mul(r.asin())).toPrecision(n)}finally{h.precision=t}};h.sin=function(e){return e.sin()};h.cos=function(e){return e.cos()};h.tan=function(e){return e.tan()};h.asin=function(e){return e.asin()};h.acos=function(e){return e.acos()};h.atan=function(e){return e.atan()};h.atan2=function(e,n){let t=e instanceof h?e:new h(e);if(t.isNaN()||n.isNaN())return h.NAN;let i=h.PI,r=i.div(h.TWO);if(n.isZero())return t.isZero()?h.ZERO:t.significand>0n?r:r.neg();let o=t.div(n);return n.significand>0n?o.atan():t.significand>=0n?o.atan().add(i):o.atan().sub(i)};h.prototype.sinh=function(){if(this.isNaN())return h.NAN;if(this.isZero())return h.ZERO;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:h.NEGATIVE_INFINITY;let e=h.precision,n=ge(this);if(n<0){if(-2*n>=e+4)return this.toPrecision(e);let r=h.precision;h.precision=e-n+5;try{let o=this.exp();return o.sub(o.inv()).mulToPrecision(h.HALF,e)}finally{h.precision=r}}if(Math.abs(this.toNumber())>1.16*(e+3)){let r=this.abs().exp().div(h.TWO);return this.significand>0n?r:r.neg()}let t=this.exp(),i=t.inv();return t.sub(i).div(h.TWO)};h.prototype.cosh=function(){if(this.isNaN())return h.NAN;if(this.isZero())return h.ONE;if(!this.isFinite())return h.POSITIVE_INFINITY;let e=h.precision;if(Math.abs(this.toNumber())>1.16*(e+3))return this.abs().exp().div(h.TWO);let n=this.exp(),t=n.inv();return n.add(t).div(h.TWO)};h.prototype.tanh=function(){if(this.isNaN())return h.NAN;if(this.isZero())return h.ZERO;if(!this.isFinite())return this.significand>0n?h.ONE:h.NEGATIVE_ONE;let e=h.precision,n=ge(this);if(n<0){if(-2*n>=e+4)return this.toPrecision(e);let i=h.precision;h.precision=e-n+5;try{let r=this.mul(h.TWO).exp();return r.sub(h.ONE).div(r.add(h.ONE)).toPrecision(e)}finally{h.precision=i}}if(Math.abs(this.toNumber())>1.16*(e+3))return this.significand>0n?h.ONE:h.NEGATIVE_ONE;let t=this.mul(h.TWO).exp();return t.sub(h.ONE).div(t.add(h.ONE))};h.sinh=function(e){return e.sinh()};h.cosh=function(e){return e.cosh()};h.tanh=function(e){return e.tanh()};h.prototype.expm1=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:h.NEGATIVE_ONE;if(this.isZero())return h.ZERO;let e=h.precision,n=ge(this);if(n<0&&-n>=e+2)return this.toPrecision(e);if(n<0){let t=h.precision;h.precision=e-n+5;try{return this.exp().sub(h.ONE).toPrecision(e)}finally{h.precision=t}}return this.exp().sub(h.ONE)};h.prototype.log1p=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:h.NAN;if(this.isZero())return h.ZERO;let e=h.ONE.add(this);if(e.isZero())return h.NEGATIVE_INFINITY;if(e.significand<0n)return h.NAN;let n=h.precision,t=ge(this);if(t<0&&-t>=n+2)return this.toPrecision(n);if(t<0){let i=h.precision;h.precision=n-t+5;try{return h.ONE.add(this).ln().toPrecision(n)}finally{h.precision=i}}return h.ONE.add(this).ln()};h.prototype.asinh=function(){if(this.isNaN())return h.NAN;if(this.isZero())return h.ZERO;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:h.NEGATIVE_INFINITY;let e=this.significand<0n,n=this.abs(),t=h.precision,i=ge(this);if(i<0&&-2*i>=t+4)return this.toPrecision(t);let r=()=>n.add(n.mul(n).add(h.ONE).sqrt()).ln(),o;if(i<0){let s=h.precision;h.precision=t-i+5;try{o=r().toPrecision(t)}finally{h.precision=s}}else o=r();return e?o.neg():o};h.prototype.acosh=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:h.NAN;if(this.lt(h.ONE))return h.NAN;if(this.eq(1))return h.ZERO;let e=this.sub(h.ONE).div(h.TWO).sqrt();return h.TWO.mul(e.asinh())};h.prototype.atanh=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return h.NAN;if(this.isZero())return h.ZERO;let e=this.abs();if(e.eq(1))return this.significand>0n?h.POSITIVE_INFINITY:h.NEGATIVE_INFINITY;if(e.gt(h.ONE))return h.NAN;let n=h.precision,t=ge(this);if(-2*t>=n+4)return this.toPrecision(n);let i=h.precision;h.precision=n-t+5;try{return h.ONE.add(this).div(h.ONE.sub(this)).ln().mulToPrecision(h.HALF,n)}finally{h.precision=i}};h.prototype.nthRoot=function(e){if(this.isNaN()||!Number.isInteger(e)||e===0)return h.NAN;if(e===1)return this;if(e===2)return this.sqrt();if(e===3)return this.cbrt();if(e<0)return this.nthRoot(-e).inv();if(this.isZero())return h.ZERO;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:e%2===0?h.NAN:h.NEGATIVE_INFINITY;if(this.significand<0n)return e%2===0?h.NAN:this.neg().nthRoot(e).neg();let n=h.precision,t=h.precision;h.precision=n+8;try{return h.exp(this.ln().div(new h(e))).toPrecision(n)}finally{h.precision=t}};h.asinh=function(e){return e.asinh()};h.acosh=function(e){return e.acosh()};h.atanh=function(e){return e.atanh()};h.expm1=function(e){return e.expm1()};h.log1p=function(e){return e.log1p()};h.nthRoot=function(e,n){return e.nthRoot(n)};function yu(e){let n=Ye(e);if(n<=1023){let u=Math.cbrt(Number(e));if(Number.isFinite(u)&&u>=1)return BigInt(Math.floor(u))}let t=n-51,i=Number(e>>BigInt(t)),r=Math.cbrt(i),o=Math.floor(t/3),s=t%3;s===1&&(r*=1.2599210498948732),s===2&&(r*=1.5874010519681994);let a=BigInt(Math.round(r))<<BigInt(o);return a>0n?a:1n}var _1=1n<<32n;var I1=[BigInt(4),BigInt(2),BigInt(4),BigInt(2),BigInt(4),BigInt(6),BigInt(2),BigInt(6)];var lm=53,Nu=Math.floor(Math.log10(Math.pow(2,lm))),cm=1e-10,we=1e6;var Wn=1e4;function kn(e,n){if(e===0)return n;if(n===0||e===n)return e;if(!Number.isInteger(e)||!Number.isInteger(n))return NaN;for(;n!==0;)[e,n]=[n,e%n];return e<0?-e:e}function Tt(e,n){if(e===0||n===0)return 0;let t=BigInt(e)*BigInt(n)/BigInt(kn(e,n));return t<0n&&(t=-t),Number(t)}function _t(e){if(!Number.isInteger(e)||e<0)return NaN;if(e>=170)return 1/0;let n=1;for(let t=2;t<=e;t++)n=n*t;return n}function It(e){if(!Number.isInteger(e)||e<0)return NaN;if(e<0)return NaN;if(e<=1)return 1;let n=e;for(;e>2;)e-=2,n*=e;return n}function St(e,n=cm){return typeof e=="number"&&Math.abs(e)<=n?0:e}function fm(e,n,t){let o=!Number.isFinite(n),s=m=>o?1/m:n+m,a=(m,g,y)=>{let E=.01*Math.max(1,Math.abs(y));for(let N=1;N<=5;N++){let w=e(s(m*Math.pow(g/m,N/6)));if(!Number.isFinite(w)||Math.abs(w-y)>E)return!1}return!0},u=o?1/t:t,l=0,c=!1,f=NaN,p=NaN;for(let m=1;m<=60;m++){let g=e(s(u));if(!Number.isFinite(g))return m-1;let y=Math.abs(g);if(m===1){l=y,f=y,p=u,u*=.125;continue}if(Math.abs(y-f)<=1e-10*Math.max(1,y))return a(p,u,g)?1/0:0;if(c&&l>1e-6&&y<1e-8*l)return m-1;y>l&&(c=!0,l=y),f=y,p=u,u*=.125}return 1/0}function Ni(e,n,t=1,i){if(t===0){let u=Ni(e,n,-1,i),l=Ni(e,n,1,i);return u===void 0||l===void 0?NaN:Math.abs(u-l)>1e-5?NaN:(u+l)/2}let r=t>0?1:-1,o=fm(e,n,r);if(o===0)return NaN;let[s,a]=Or(e,n,{step:r,deadline:i,...Number.isFinite(o)?{maxeval:o}:{}});return Number.isFinite(s)&&a>1e-6*Math.max(1,Math.abs(s))?NaN:s}var Ti=["number","finite_number","complex","finite_complex","imaginary","real","finite_real","rational","finite_rational","integer","finite_integer","non_finite_number"],jr=["indexed_collection","list","tuple"],_i=[...jr,"collection","set","record","dictionary"],Ii=["scalar",...Ti,"boolean","string"],Ur=["value","color",..._i,...Ii],Hr=["expression","symbol","function",...Ur],Zr=["any","unknown","nothing","never","error",...Hr],Xn=new Set(Ti),Tu=new Set(_i),_u=new Set(Ii),An=new Set(Zr);function Iu(e){return typeof e!="string"?!1:An.has(e)}function Si(e){return typeof e=="string"?An.has(e):typeof e!="object"||!("kind"in e)?!1:e.kind==="signature"||e.kind==="union"||e.kind==="intersection"||e.kind==="negation"||e.kind==="value"||e.kind==="tuple"||e.kind==="list"||e.kind==="record"||e.kind==="dictionary"||e.kind==="set"||e.kind==="symbol"||e.kind==="expression"||e.kind==="numeric"||e.kind==="collection"||e.kind==="indexed_collection"||e.kind==="reference"}var wi=class{input;pos=0;line=1;column=1;tokens=[];tolerant;constructor(n,t){this.input=n,this.tolerant=t?.tolerant??!1}saveState(){return{pos:this.pos,line:this.line,column:this.column,tokens:[...this.tokens]}}restoreState(n){this.pos=n.pos,this.line=n.line,this.column=n.column,this.tokens=n.tokens}error(n){throw new Error(`Lexer error at line ${this.line}, column ${this.column}: ${n}`)}peek(n=0){let t=this.pos+n;return t<this.input.length?this.input[t]:""}advance(){let n=this.input[this.pos++];return n===`
|
|
3
3
|
`?(this.line++,this.column=1):this.column++,n}match(n){if(this.input.slice(this.pos,this.pos+n.length)===n){for(let t=0;t<n.length;t++)this.advance();return!0}return!1}isEOF(){return this.pos>=this.input.length}skipWhitespace(){for(;!this.isEOF()&&/\s/.test(this.peek());)this.advance()}readIdentifier(){let n="";for(;!this.isEOF()&&/[a-zA-Z0-9_]/.test(this.peek());)n+=this.advance();return n}readVerbatimString(){if(!this.match("`"))return"";let n="";for(;!this.isEOF()&&this.peek()!=="`";)this.match("\\`")?n+="`":this.match("\\\\")?n+="\\":n+=this.advance();return this.isEOF()&&this.error("Unterminated verbatim string"),this.advance(),n}readStringLiteral(){let n=this.advance(),t="";for(;!this.isEOF()&&this.peek()!==n;)this.match("\\"+n)?t+=n:this.match("\\\\")?t+="\\":t+=this.advance();return this.isEOF()&&this.error("Unterminated string literal"),this.advance(),t}readNumber(){let n="";if((this.peek()==="-"||this.peek()==="+")&&(n+=this.advance()),this.match("0x")||this.match("0X")){for(n+="x";!this.isEOF()&&/[0-9a-fA-F]/.test(this.peek());)n+=this.advance();return"0"+n}if(this.match("0b")||this.match("0B")){for(n+="b";!this.isEOF()&&/[01]/.test(this.peek());)n+=this.advance();return"0"+n}for(;!this.isEOF()&&/[0-9]/.test(this.peek());)n+=this.advance();if(this.peek()==="."&&/[0-9]/.test(this.peek(1)))for(n+=this.advance();!this.isEOF()&&/[0-9]/.test(this.peek());)n+=this.advance();if(this.peek()==="e"||this.peek()==="E")for(n+=this.advance(),(this.peek()==="+"||this.peek()==="-")&&(n+=this.advance());!this.isEOF()&&/[0-9]/.test(this.peek());)n+=this.advance();return n}createToken(n,t){return{type:n,value:t,position:this.pos-t.length,line:this.line,column:this.column-t.length}}nextToken(){if(this.skipWhitespace(),this.isEOF())return this.createToken("EOF","");let n=this.pos,t=this.peek();if(this.match("->"))return this.createToken("->","->");if(this.match(".."))return this.createToken("..","..");if(this.match("+\u221E")||this.match("+oo"))return this.createToken("PLUS_INFINITY",this.input.slice(n,this.pos));if(this.match("-\u221E")||this.match("-oo"))return this.createToken("MINUS_INFINITY",this.input.slice(n,this.pos));if(this.match("+infinity"))return this.createToken("PLUS_INFINITY","+infinity");if(this.match("-infinity"))return this.createToken("MINUS_INFINITY","-infinity");if(/[a-zA-Z_]/.test(t)){let i=this.readIdentifier();switch(i){case"true":return this.createToken("TRUE",i);case"false":return this.createToken("FALSE",i);case"nan":return this.createToken("NAN",i);case"infinity":return this.createToken("INFINITY",i);case"oo":return this.createToken("INFINITY",i);default:return this.createToken("IDENTIFIER",i)}}switch(t){case"|":return this.advance(),this.createToken("|","|");case"&":return this.advance(),this.createToken("&","&");case"!":return this.advance(),this.createToken("!","!");case"^":return this.advance(),this.createToken("^","^");case"(":return this.advance(),this.createToken("(","(");case")":return this.advance(),this.createToken(")",")");case"<":return this.advance(),this.createToken("<","<");case">":return this.advance(),this.createToken(">",">");case"[":return this.advance(),this.createToken("[","[");case"]":return this.advance(),this.createToken("]","]");case",":return this.advance(),this.createToken(",",",");case":":return this.advance(),this.createToken(":",":");case"?":return this.advance(),this.createToken("?","?");case"*":return this.advance(),this.createToken("*","*");case"+":return/[0-9]/.test(this.peek(1))?this.createToken("NUMBER_LITERAL",this.readNumber()):(this.advance(),this.createToken("+","+"));case"x":return/[0-9]/.test(this.peek(1))?(this.advance(),this.createToken("x","x")):(this.advance(),this.createToken("x","x"))}if(t==='"'||t==="'")return this.createToken("STRING_LITERAL",this.readStringLiteral());if(t==="`")return this.createToken("VERBATIM_STRING",this.readVerbatimString());if(/[0-9]/.test(t)||t==="-"&&/[0-9]/.test(this.peek(1))){let i=this.readNumber();return this.peek()==="x"&&/[0-9]/.test(this.peek(1)),this.createToken("NUMBER_LITERAL",i)}if(t==="\u221E")return this.advance(),this.createToken("INFINITY","\u221E");if(this.tolerant)return this.createToken("EOF","");this.error(`Unexpected character: ${t}`)}tokenize(){let n=[];for(;!this.isEOF();){let t=this.nextToken();if(t&&(n.push(t),t.type==="EOF"))break}return n}peekToken(){if(this.tokens.length===0){let n=this.nextToken();n&&this.tokens.push(n)}return this.tokens[0]||this.createToken("EOF","")}consumeToken(){if(this.tokens.length===0){let n=this.nextToken();if(n)return n}return this.tokens.shift()||this.createToken("EOF","")}matchToken(n){return this.peekToken().type===n?(this.consumeToken(),!0):!1}expectToken(n){let t=this.consumeToken();return t.type!==n&&this.error(`Expected ${n}, got ${t.type}`),t}};var Mi=class{lexer;typeResolver;current;allowTrailing;_end=0;constructor(n,t){this.allowTrailing=t?.allowTrailing??!1,this.lexer=new wi(n,{tolerant:this.allowTrailing}),this.typeResolver=t?.typeResolver??{forward:()=>{},resolve:()=>{},get names(){return[]}},this.current=this.lexer.consumeToken()}get endOffset(){return this._end}error(n,t){this.errorAtToken(this.current,n,t)}errorAtToken(n,t,i){let r=this.lexer.input;this.allowTrailing&&(r=r.slice(0,n.position+n.value.length));let s=r.split(`
|
|
4
4
|
`)[n.line-1]||r,a=n.column,u=" ".repeat(Math.max(0,a-1))+"^",l=["","Invalid type",`| ${s}`,`| ${u}`,"|",`| ${t}`];i&&l.push(`| ${i}`),l.push("");let c=new Error(l.join(`
|
|
@@ -1743,7 +1743,7 @@ vec2 _iv_mod(vec2 a, vec2 b) {
|
|
|
1743
1743
|
}
|
|
1744
1744
|
`;function qp(e={}){let n=e.trigAbsPad??0;return l1.replace("__IV_TRIG_ABS__",Ne(n))}var o5=qp(),Vp={Add:(e,n)=>{if(e.length===0)return"vec2(0.0, 0.0)";let t=n(e[0]);for(let i=1;i<e.length;i++)t=`_iv_add(${t}, ${n(e[i])})`;return t},Subtract:([e,n],t)=>{if(e===null||n===null)throw new Error("Subtract: missing argument");return`_iv_sub(${t(e)}, ${t(n)})`},Multiply:(e,n)=>{if(e.length===0)return"vec2(1.0, 1.0)";let t=n(e[0]);for(let i=1;i<e.length;i++)t=`_iv_mul(${t}, ${n(e[i])})`;return t},Divide:([e,n],t)=>{if(e===null||n===null)throw new Error("Divide: missing argument");return`_iv_div(${t(e)}, ${t(n)})`},Negate:([e],n)=>{if(e===null)throw new Error("Negate: no argument");return`_iv_negate(${n(e)})`},Square:([e],n)=>{if(e===null)throw new Error("Square: no argument");return`_iv_square(${n(e)})`},Sqrt:([e],n)=>{if(e===null)throw new Error("Sqrt: no argument");return`_iv_sqrt(${n(e)})`},Abs:([e],n)=>{if(e===null)throw new Error("Abs: no argument");return`_iv_abs(${n(e)})`},Exp:([e],n)=>{if(e===null)throw new Error("Exp: no argument");return`_iv_exp(${n(e)})`},Ln:([e],n)=>{if(e===null)throw new Error("Ln: no argument");return`_iv_ln(${n(e)})`},Log:(e,n)=>e.length===1?`_iv_log10(${n(e[0])})`:`_iv_div(_iv_ln(${n(e[0])}), _iv_ln(${n(e[1])}))`,Lb:([e],n)=>{if(e===null)throw new Error("Lb: no argument");return`_iv_log2(${n(e)})`},Sin:([e],n)=>{if(e===null)throw new Error("Sin: no argument");return`_iv_sin(${n(e)})`},Cos:([e],n)=>{if(e===null)throw new Error("Cos: no argument");return`_iv_cos(${n(e)})`},Tan:([e],n)=>{if(e===null)throw new Error("Tan: no argument");return`_iv_tan(${n(e)})`},Arcsin:([e],n)=>{if(e===null)throw new Error("Arcsin: no argument");return`_iv_asin(${n(e)})`},Arccos:([e],n)=>{if(e===null)throw new Error("Arccos: no argument");return`_iv_acos(${n(e)})`},Arctan:([e],n)=>{if(e===null)throw new Error("Arctan: no argument");return`_iv_atan(${n(e)})`},Floor:([e],n)=>{if(e===null)throw new Error("Floor: no argument");return`_iv_floor(${n(e)})`},Ceil:([e],n)=>{if(e===null)throw new Error("Ceil: no argument");return`_iv_ceil(${n(e)})`},Round:([e],n)=>{if(e===null)throw new Error("Round: no argument");return`_iv_round(${n(e)})`},Truncate:([e],n)=>{if(e===null)throw new Error("Truncate: no argument");return`_iv_trunc(${n(e)})`},Fract:([e],n)=>{if(e===null)throw new Error("Fract: no argument");return`_iv_fract(${n(e)})`},Sign:([e],n)=>{if(e===null)throw new Error("Sign: no argument");return`_iv_sign(${n(e)})`},Heaviside:([e],n)=>{if(e===null)throw new Error("Heaviside: no argument");return`_iv_heaviside(${n(e)})`},Mod:([e,n],t)=>{if(e===null||n===null)throw new Error("Mod: missing argument");return`_iv_mod(${t(e)}, ${t(n)})`},Min:(e,n)=>{if(e.length===0)throw new Error("Min: no argument");let t=n(e[0]);for(let i=1;i<e.length;i++)t=`_iv_min(${t}, ${n(e[i])})`;return t},Max:(e,n)=>{if(e.length===0)throw new Error("Max: no argument");let t=n(e[0]);for(let i=1;i<e.length;i++)t=`_iv_max(${t}, ${n(e[i])})`;return t},Power:([e,n],t)=>{if(e===null||n===null)throw new Error("Power: missing argument");if(T(e,"ExponentialE"))return`_iv_exp(${t(n)})`;if(P(n)&&n.im===0){let i=n.re;if(i===.5)return`_iv_sqrt(${t(e)})`;if(i===2)return`_iv_square(${t(e)})`;if(Number.isInteger(i)&&i>=0)return`_iv_powi(${t(e)}, ${Ne(i)})`;if(!Number.isInteger(i)&&i>0){let r=n.numerator?.re,o=n.denominator?.re;return Number.isInteger(r)&&Number.isInteger(o)&&o>1&&o%2!==0?`_iv_powrat(${t(e)}, ${Ne(r)}, ${Ne(i)})`:`_iv_powf(${t(e)}, ${Ne(i)})`}throw new Error(`interval-glsl: Power with exponent \`${n.toString()}\` is not yet supported`)}throw new Error("interval-glsl: Power with a variable exponent is not yet supported")}},Pr={Pi:"vec2(3.14159265359, 3.14159265359)",ExponentialE:"vec2(2.71828182846, 2.71828182846)",GoldenRatio:"vec2(1.61803398875, 1.61803398875)",CatalanConstant:"vec2(0.91596559417, 0.91596559417)",EulerGamma:"vec2(0.57721566490, 0.57721566490)"},ru=class extends ai{languageId="interval-glsl";getOperators(){return{}}getFunctions(){return Vp}getConstants(){return Pr}createTarget(n={}){return super.createTarget({operators:()=>{},functions:t=>Vp[t],number:t=>`vec2(${Ne(t)}, ${Ne(t)})`,complex:()=>{throw new Error("interval-glsl: complex values are not supported")},var:t=>Pr[t],...n})}getPreamble(n={}){return qp(n)}compile(n,t={}){let{vars:i,trigAbsPad:r}=t,o=this.createTarget({var:u=>{if(i&&u in i)return i[u];if(u in Pr)return Pr[u]}}),s=x.compile(n,o),a=x.withReferences({target:"interval-glsl",success:!0,code:s},n,o,i?new Set(Object.keys(i)):void 0);return(s.includes("_iv_")||(a.freeSymbols?.length??0)>0)&&(a.preamble=this.getPreamble({trigAbsPad:r})),a}compileExclusionShader(n,t={}){let{version:i="300 es",precision:r="highp",trigAbsPad:o}=t,s=this.compile(n),a=s.freeSymbols??[];if(a.length>2)throw new Error(`interval-glsl exclusion shader supports at most 2 free variables (got ${a.length}: ${a.join(", ")})`);let u=a.map(m=>`vec2 ${m}`).join(", "),[l,c]=a,f=["void main() {"];f.push(" vec2 _cell = gl_FragCoord.xy / u_resolution;"),f.push(" vec2 _step = 1.0 / u_resolution;");let p=[];return l!==void 0&&(f.push(" float _xlo = mix(u_domainX.x, u_domainX.y, _cell.x);"),f.push(" float _xhi = mix(u_domainX.x, u_domainX.y, _cell.x + _step.x);"),f.push(" float _xext = max(abs(u_domainX.x), abs(u_domainX.y));"),p.push("_iv_widen_box(vec2(_xlo, _xhi), _xext)")),c!==void 0&&(f.push(" float _ylo = mix(u_domainY.x, u_domainY.y, _cell.y);"),f.push(" float _yhi = mix(u_domainY.x, u_domainY.y, _cell.y + _step.y);"),f.push(" float _yext = max(abs(u_domainY.x), abs(u_domainY.y));"),p.push("_iv_widen_box(vec2(_ylo, _yhi), _yext)")),f.push(` vec2 _f = _implicit(${p.join(", ")});`),f.push(" bool _excluded = (_f.x > 0.0 || _f.y < 0.0);"),f.push(" fragColor = _excluded ? vec4(0.0, 0.0, 0.0, 1.0) : vec4(1.0);"),f.push("}"),[`#version ${i}`,`precision ${r} float;`,"",this.getPreamble({trigAbsPad:o}).trim(),"","uniform vec2 u_domainX; // [min, max] for the 1st free variable","uniform vec2 u_domainY; // [min, max] for the 2nd free variable","uniform vec2 u_resolution; // render target size, in pixels","","out vec4 fragColor;","","// Interval evaluation of the implicit field f over a cell box. The box is","// outward-rounded by the caller (main(), via _iv_widen_box).",`vec2 _implicit(${u}) {`,` return ${s.code};`,"}","",f.join(`
|
|
1745
1745
|
`),""].join(`
|
|
1746
|
-
`)}};var a5="0.69.
|
|
1746
|
+
`)}};var a5="0.69.1";export{x as BaseCompiler,ai as GLSLTarget,Hn as GPUShaderTarget,ru as IntervalGLSLTarget,iu as IntervalJavaScriptTarget,Is as JavaScriptTarget,$s as PythonTarget,Cs as WGSLTarget,ug as compile,a5 as version};
|
|
1747
1747
|
/*! Bundled license information:
|
|
1748
1748
|
|
|
1749
1749
|
complex-esm/dist/src/complex.js:
|
package/dist/compile.min.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Compile 0.69.
|
|
1
|
+
/** Compile 0.69.1 */
|
|
2
2
|
(function(global,factory){typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'],factory):(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Compile = {}));})(this, (function (exports) { 'use strict';
|
|
3
3
|
"use strict";var Compile=(()=>{var Vr=Object.defineProperty;var jp=Object.getOwnPropertyDescriptor;var Up=Object.getOwnPropertyNames;var Hp=Object.prototype.hasOwnProperty;var Zp=(e,n)=>{for(var t in n)Vr(e,t,{get:n[t],enumerable:!0})},Yp=(e,n,t,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of Up(n))!Hp.call(e,r)&&r!==t&&Vr(e,r,{get:()=>n[r],enumerable:!(i=jp(n,r))||i.enumerable});return e};var Wp=e=>Yp(Vr({},"__esModule",{value:!0}),e);var y1={};Zp(y1,{BaseCompiler:()=>x,GLSLTarget:()=>gt,GPUShaderTarget:()=>Tn,IntervalGLSLTarget:()=>Br,IntervalJavaScriptTarget:()=>Fr,JavaScriptTarget:()=>Nr,PythonTarget:()=>wr,WGSLTarget:()=>Ir,compile:()=>Lc,version:()=>b1});var Ze=class extends Error{cause;value;constructor({message:n,value:t,cause:i}={}){super(n??"Operation canceled"),t&&(this.value=t),this.cause=i,this.name="CancellationError"}};function xt(e){if(e!==void 0&&Date.now()>=e)throw new Ze({cause:"timeout",message:"Timeout exceeded"})}var mi;function di(){return mi}function hi(e,n){let t=mi;mi=e;try{return n()}finally{mi=t}}function qr(e,n){let t=Date.now();for(;;){let{done:i,value:r}=e.next();if(i)return r;if(Date.now()-t>=n)throw new Ze({value:r,cause:"timeout",message:`Timeout exceeded (${n}ms)`})}}function Jr(e,n,t={}){let{contract:i=.125,step:r=1,power:o=2,atol:s=1e-16,rtol:a=s>0?0:Math.sqrt(Number.EPSILON),maxeval:u=1e6,breaktol:l=2,deadline:c=di()}=t;return isFinite(n)?hi(c,()=>{let f=r,p=Math.pow(1/i,o),m=e(n+f),g=[m],y=1/0,E=1;for(;E<u;){xt(c),E+=1,f*=i,g.push(e(n+f));let N=p,w=1/0;for(let A=g.length-2;A>=0;A--){let C=g[A];g[A]=g[A+1]+(g[A+1]-g[A])/(N-1);let O=Math.abs(g[A]-C);w=Math.min(w,O),O<y&&(m=g[A],y=O),N*=p}if(w>l*y||!isFinite(w)||y<=Math.max(a*Math.abs(m),s))break}return[m,y]}):Jr(f=>e(1/f),1/n,{rtol:a,atol:s,maxeval:u,contract:Math.abs(i)>1?1/i:i,step:1/r,power:o,deadline:c})}var su=new Map,Xp=1e5;function J(e){if(e<=Xp){let n=su.get(e);return n===void 0&&(n=10n**BigInt(e),su.set(e,n)),n}return 10n**BigInt(e)}function Ye(e){if(e<0n&&(e=-e),e===0n)return 0;let n=0,t=1;for(;e>>BigInt(t)>0n;)t*=2;for(let i=t>>1;i>=1;i>>=1)e>>BigInt(i)>0n&&(n+=i,e>>=BigInt(i));return n+1}function uu(e,n,t){return e*n>>BigInt(t)}function lu(e,n,t){return(e<<BigInt(t))/n}function yi(e,n){if(e===0n)return 0n;if(e<0n)throw new RangeError("fpsqrt: negative input");let t=e<<BigInt(n),i;if(n<Qp){i=Gr(t);let a;do a=i,i=(i+t/i)/2n;while(Ae(i-a)>1n)}else i=jr(t,Ye(t));let r=(i+t/i)/2n,o=Ae(i*i-t);return Ae(r*r-t)<o?r:i}function Gr(e){let n=Ye(e);if(n<=1023){let s=Math.sqrt(Number(e));if(Number.isFinite(s)&&s>=1)return BigInt(Math.floor(s))}let t=n-52,i=Number(e>>BigInt(t)),r=Math.sqrt(i);t&1&&(r*=Math.SQRT2);let o=BigInt(Math.round(r))<<BigInt(t>>1);return o>0n?o:1n}var cu=1024,Qp=640;function jr(e,n){if(n<cu){let o=Gr(e),s;do s=o,o=(o+e/o)/2n;while(Ae(o-s)>1n);for(;o*o>e;)o-=1n;for(;(o+1n)*(o+1n)<=e;)o+=1n;return o}let t=n>>2<<1,i=jr(e>>BigInt(t),n-t)<<BigInt(t>>1),r;do r=i,i=(i+e/i)/2n;while(Ae(i-r)>1n);for(;i*i>e;)i-=1n;for(;(i+1n)*(i+1n)<=e;)i+=1n;return i}function Ae(e){return e<0n?-e:e}function Yn(e){if(e===0n)return 1;if(e<0n&&(e=-e),e<0x20000000000000n){let i=Number(e);return i<1e8?i<1e4?i<100?i<10?1:2:i<1e3?3:4:i<1e6?i<1e5?5:6:i<1e7?7:8:i<1e12?i<1e10?i<1e9?9:10:i<1e11?11:12:i<1e14?i<1e13?13:14:i<1e15?15:16}let n=e.toString(16).length*4,t=Math.ceil(n*.30102999566398);for(;e<J(t-1);)t--;for(;e>=J(t);)t++;return t}var Kp=.7;function Ur(e,n){if(e===0n)return 1n<<BigInt(n);let t=Math.round(Kp*Math.sqrt(n)),i=t+8,r=n+i,o=BigInt(r),s=1n<<o,a=BigInt(i),u=e<<a,l=u<0n,c=l?-u:u,f=Math.max(0,Ye(c)-r+t);c>>=BigInt(f),u=l?-c:c;let p=s,m=u;p+=m;for(let g=2;m=(m*u>>o)/BigInt(g),m!==0n;g++)p+=m;for(let g=0;g<f;g++)p=p*p>>o;return p+(1n<<a-1n)>>a}var em=4e4;function Hr(e,n){let t=1n<<BigInt(n);if(e<=0n)throw new RangeError("fpln: input must be positive");return e===t?0n:n>=em?im(e,n):nm(e,n)}function nm(e,n){let t=BigInt(n),i=1n<<t,r=52,o=n-r,s;if(o>0){let g=Number(e>>BigInt(o))/2**r;s=BigInt(Math.round(Math.log(g)*2**r))<<BigInt(o)}else{let g=Number(e)/Number(i);s=BigInt(Math.round(Math.log(g)*Number(i)))}let a=e*Ur(-s,n)>>t,l=(a-i<<t)/(a+i),c=l<0n?-l:l,f=c*c>>t,p=c,m=c;for(let g=3n;p=p*f>>t,p!==0n;g+=2n)m+=p/g;return s+(l<0n?-2n:2n)*m}var wn=null;function tm(e){if(wn!==null){if(wn.bits===e)return wn.value;if(wn.bits>e)return wn.value>>BigInt(wn.bits-e)}let n=Math.ceil(e*xi)+12,t;if(n<=au.length){let i=au.slice(0,n);t=(BigInt(i)<<BigInt(e))/J(i.length)}else t=lm(e);return wn={bits:e,value:t},t}function im(e,n){let t=BigInt(n),i=Ye(e)-n,r=Math.max(2,Math.ceil(n/2+4-i)),o=e<<BigInt(r-2),s=1n<<t,a=o;for(;Ae(s-a)>1n;){let l=s+a>>1n;a=Et(s*a),s=l}return bi(n)*o/(2n*s)-BigInt(r)*tm(n)}var Zn="314159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316527120190914564856692346034861045432664821339360726024914127372458700660631558817488152092096282925409171536436789259036001133053054882046652138414695194151160943305727036575959195309218611738193261179310511854807446237996274956735188575272489122793818301194912983367336244065664308602139494639522473719070217986094370277053921717629317675238467481846766940513200056812714526356082778577134275778960917363717872146844090122495343014654958537105079227968925892354201995611212902196086403441815981362977477130996051870721134999999837297804995105973173281609631859502445945534690830264252230825334468503526193118817101000313783875288658753320838142061717766914730359825349042875546873115956286388235378759375195778185778053217122680661300192787661119590921642019893809525720106548586327886593615338182796823030195203530185296899577362259941389124972177528347913151557485724245415069595082953311686172785588907509838175463746493931925506040092770167113900984882401285836160356370766010471018194295559619894676783744944825537977472684710404753464620804668425906949129331367702898915210475216205696602405803815019351125338243003558764024749647326391419927260426992279678235478163600934172164121992458631503028618297455570674983850549458858692699569092721079750930295532116534498720275596023648066549911988183479775356636980742654252786255181841757467289097777279380008164706001614524919217321721477235014144197356854816136115735255213347574184946843852332390739414333454776241686251898356948556209921922218427255025425688767179049460165346680498862723279178608578438382796797668145410095388378636095068006422512520511739298489608412848862694560424196528502221066118630674427862203919494504712371378696095636437191728746776465757396241389086583264599581339047802759009946576407895126946839835259570982582262052248940772671947826848260147699090264013639443745530506820349625245174939965143142980919065925093722169646151570985838741059788595977297549893016175392846813826868386894277415599185592524595395943104997252468084598727364469584865383673622262609912460805124388439045124413654976278079771569143599770012961608944169486855584840635",xi=Math.log10(2),au="693147180559945309417232121458176568075500134360255254120680009493393621969694715605863326996418687542001481020570685733685520235758130557032670751635075961930727570828371435190307038623891673471123350115364497955239120475172681574932065155524734139525882950453007095326366642654104239157814952043740430385500801944170641671518644712839968171784546957026271631064546150257207402481637773389638550695260668341137273873722928956493547025762652098859693201965058554764703306793654432547632744951250406069438147104689946506220167720424524529612687946546193165174681392672504103802546259656869144192871608293803172714367782654877566485085674077648451464439940461422603193096735402574446070308096085047486638523138181676751438667476647890881437141985494231519973548803751658612753529166100071053558249879414729509293113897155998205654392871700072180857610252368892132449713893203784393530887748259701715591070882368362758984258918535302436342143670611892367891923723146723217205340164925687274778234453534764811494186423867767744060695626573796008670762571991847340226514628379048830620330611446300737194890027436439650025809365194430411911506080948793067865158870900605203468429736193841289652556539686022194122924207574321757489097706752687115817051137009158942665478595964890653058460258668382940022833005382074005677053046787001841624044188332327983863490015631218895606505531512721993983320307514084260914790012651682434438935724727882054862715527418772430024897945401961872339808608316648114909306675193393128904316413706813977764981769748689038877899912965036192707108892641052309247839173735012298424204995689359922066022046549415106139187885744245577510206837030866619480896412186807790208181588580001688115973056186676199187395200766719214592236720602539595436541655311295175989940056000366513567569051245926825743946483168332624901803824240824231452306140963805700702551387702681785163069025513703234053802145019015374029509942262995779647427138157363801729873940704242179972266962979939312706935747240493386530879758721699645129446491883771156701678598804981838896784134938314014073166472765327635919233511233389338709513209059272185471328975470797891384445466676192702885533423429899321803769154973340267546758873236778342916191810430116091695265547859732891763545556742863877463987101912431754255888301206779210280341206879759143081283307230300883494705792496591005860012341561757413272465943",rm=13591409n,om=545140134n,sm=10939058860032000n,am=47.11;function gi(e,n){if(n-e===1){let l,c;if(e===0)l=1n,c=1n;else{l=BigInt(6*e-5)*BigInt(2*e-1)*BigInt(6*e-1);let p=BigInt(e);c=p*p*p*sm}let f=l*(rm+om*BigInt(e));return e&1&&(f=-f),[l,c,f]}let t=e+n>>1,[i,r,o]=gi(e,t),[s,a,u]=gi(t,n);return[i*s,r*a,a*o+i*u]}function fu(e){return Math.max(2,Math.floor(e/am)+3)}function um(e){let[,n,t]=gi(0,fu(e)),i=1n<<BigInt(e),r=Et(10005n*i*i);return n*426880n*r/t}function pu(e){let[,n,t]=gi(0,fu(Math.ceil(e/xi))),i=J(e),r=Et(10005n*i*i);return n*426880n*r/t}function zr(e,n){if(n-e===1){let l=e===0?1n:BigInt(2*e-1),c=e===0?1n:9n*BigInt(2*e+1);return[l,c,l]}let t=e+n>>1,[i,r,o]=zr(e,t),[s,a,u]=zr(t,n);return[i*s,r*a,a*o+i*u]}function lm(e){let n=Math.max(2,Math.ceil(e/3.169925)+5),[,t,i]=zr(0,n);return(i<<BigInt(e+1))/(3n*t)}function Et(e){if(e<0n)throw new RangeError("bigintSqrt: negative input");if(e===0n)return 0n;let n=Ye(e);if(n>=cu)return jr(e,n);let t=Gr(e),i;do i=t,t=(t+e/t)/2n;while(Ae(t-i)>1n);for(;t*t>e;)t-=1n;for(;(t+1n)*(t+1n)<=e;)t+=1n;return t}var Mn=null;function bi(e){if(Mn!==null){if(Mn.bits===e)return Mn.value;if(Mn.bits>e)return Mn.value>>BigInt(Mn.bits-e)}let n=cm(e);return Mn={bits:e,value:n},n}function cm(e){let n=Math.ceil(e*xi)+12;if(n+1<=Zn.length){let t=Zn.slice(0,n+1);return(BigInt(t)<<BigInt(e))/J(t.length-1)}return um(e)}function vi(e,n){let t=BigInt(n),i=1n<<t;if(e===0n)return[0n,i];let r=bi(n),o=2n*r,s=r/2n,a,u=Ae(e);if(u>i<<30n){let O=Ye(u)-n+64,B=n+O,K=e<<BigInt(O),ie=2n*bi(B),V=K%ie;V<0n&&(V+=ie),a=V>>BigInt(O)}else a=e%o;a<0n&&(a+=o);let l=1n,c=1n;a>3n*s?(a=o-a,l=-1n):a>r?(a=a-r,l=-1n,c=-1n):a>s&&(a=r-a,c=-1n);let f=Math.round(n*xi),p=Math.min(18,Math.max(2,Math.ceil(.87*Math.sqrt(f)))),m=0,g=i>>BigInt(p);for(;a>g;)a=a/2n,m++;let y=a,E=i,N=a,w=i,A=a*a,C=2n*t;for(let O=2;;O+=2){if(w=(w*A>>C)/(BigInt(O)*BigInt(O-1)),w===0n){N=(N*A>>C)/(BigInt(O+1)*BigInt(O)),N!==0n&&(O%4===2?(E-=w,y-=N):(E+=w,y+=N));break}if(N=(N*A>>C)/(BigInt(O+1)*BigInt(O)),O%4===2?(E-=w,y-=N):(E+=w,y+=N),N===0n)break}for(let O=0;O<m;O++){let B=2n*y*E>>t,K=(2n*E*E>>t)-i;y=B,E=K}return[l*y,c*E]}function vt(e,n){if(e===0n)return 0n;if(e<0n)return-vt(-e,n);let t=BigInt(n),i=1n<<t,o=bi(n)/2n;if(e>i){let m=(i<<t)/e;return o-vt(m,n)}let s=4n*i/10n,a=0,u=e;for(;u>s;){let m=u*u,g=(i<<t)+m>>t,y=yi(g,n);u=(u<<t)/(i+y),a++}let l=u,c=u,f=u*u,p=2n*t;for(let m=3;c=c*f>>p,c!==0n;m+=2)m%4===3?l-=c/BigInt(m):l+=c/BigInt(m);for(let m=0;m<a;m++)l=2n*l;return l}var Zr=NaN,h=class e{static precision=50;static ZERO=Object.freeze(Object.assign(Object.create(e.prototype),{_digits:1,significand:0n,exponent:0}));static ONE=Object.freeze(Object.assign(Object.create(e.prototype),{_digits:1,significand:1n,exponent:0}));static TWO=Object.freeze(Object.assign(Object.create(e.prototype),{_digits:1,significand:2n,exponent:0}));static NEGATIVE_ONE=Object.freeze(Object.assign(Object.create(e.prototype),{_digits:1,significand:-1n,exponent:0}));static HALF=Object.freeze(Object.assign(Object.create(e.prototype),{_digits:1,significand:5n,exponent:-1}));static NAN=Object.freeze(Object.assign(Object.create(e.prototype),{_digits:1,significand:0n,exponent:NaN}));static POSITIVE_INFINITY=Object.freeze(Object.assign(Object.create(e.prototype),{_digits:1,significand:1n,exponent:1/0}));static NEGATIVE_INFINITY=Object.freeze(Object.assign(Object.create(e.prototype),{_digits:1,significand:-1n,exponent:1/0}));static _piFullPrecision=null;static _piCache=null;static _piCachePrecision=0;static _eulerGammaCache=null;static _eulerGammaCachePrecision=0;static get PI(){let n=e.precision;if(e._piCache!==null&&e._piCachePrecision===n)return e._piCache;let t=n+4,i;if(t+1<=Zn.length)e._piFullPrecision===null&&(e._piFullPrecision=new e(Zn[0]+"."+Zn.slice(1))),i=e._piFullPrecision.toPrecision(t);else{let r=t+4;i=z(pu(r),-r).toPrecision(t)}return e._piCache=i,e._piCachePrecision=n,i}static get EULER_GAMMA(){let n=e.precision;if(e._eulerGammaCache!==null&&e._eulerGammaCachePrecision>=n)return e._eulerGammaCache.toPrecision(n);let t=mm(n);return e._eulerGammaCache=t,e._eulerGammaCachePrecision=n,t}significand;exponent;_digits;digitCount(){return this._digits??(this._digits=Yn(this.significand))}constructor(n){if(n instanceof e){this.significand=n.significand,this.exponent=n.exponent;return}if(typeof n=="bigint"){[this.significand,this.exponent]=Ei(n,0);return}if(typeof n=="number"){[this.significand,this.exponent]=dm(n);return}[this.significand,this.exponent]=bu(n)}isNaN(){return Number.isNaN(this.exponent)}isZero(){return this.exponent===0&&this.significand===0n}isFinite(){return Number.isFinite(this.exponent)}isInteger(){return this.isFinite()&&this.exponent>=0}isPositive(){return this.significand>0n}isNegative(){return this.significand<0n}cmp(n){if(typeof n=="number"){if(Number.isNaN(n))return Zr;let m=this.exponent;if(Number.isNaN(m))return Zr;if(n===0)return this.significand===0n?0:this.significand>0n?1:-1;if(!Number.isFinite(m))return n===1/0?this.significand>0n?0:-1:n===-1/0?this.significand<0n?0:1:this.significand>0n?1:-1;if(this.significand===0n)return n>0?-1:1;if(n===1/0)return-1;if(n===-1/0)return 1;if(this.significand>0n!=n>0)return this.significand>0n?1:-1;if(Number.isInteger(n)&&m>=0&&m<=15){let g=this.significand*J(m),y=BigInt(n);return g<y?-1:g>y?1:0}n=new e(n)}let t=this.exponent,i=n.exponent,r=this.significand,o=n.significand;if(t!==t||i!==i)return Zr;if(!Number.isFinite(t)||!Number.isFinite(i))return!Number.isFinite(t)&&!Number.isFinite(i)?r===o?0:r>o?1:-1:Number.isFinite(t)?o>0n?-1:1:r>0n?1:-1;if(r===0n)return o===0n?0:o>0n?-1:1;if(o===0n)return r>0n?1:-1;if(r>0n&&o<0n)return 1;if(r<0n&&o>0n)return-1;if(t===i)return r<o?-1:r>o?1:0;let s=this.digitCount(),a=n.digitCount(),u=s+t,l=a+i;if(u!==l){let m=r>0n?1:-1;return u>l?m:-m}let c=r,f=o,p=Math.abs(t-i);if(p>1e3){let m=s,g=a,y=Math.max(m,g)+1;m<y&&(c=c*J(y-m)),g<y&&(f=f*J(y-g))}else t<i?f=f*J(p):c=c*J(p);return c<f?-1:c>f?1:0}eq(n){return typeof n=="number"?n===0?this.significand===0n&&this.exponent===0:n===1?this.significand===1n&&this.exponent===0:n===-1?this.significand===-1n&&this.exponent===0:Number.isInteger(n)&&Number.isFinite(this.exponent)&&this.exponent>=0&&this.exponent<=15?this.significand*J(this.exponent)===BigInt(n):this.cmp(n)===0:this.significand===n.significand&&this.exponent===n.exponent}lt(n){return this.cmp(n)===-1}lte(n){let t=this.cmp(n);return t===-1||t===0}gt(n){return this.cmp(n)===1}gte(n){let t=this.cmp(n);return t===1||t===0}add(n){typeof n=="number"&&(n=new e(n));let t=this.exponent,i=n.exponent;if(Number.isFinite(t)&&Number.isFinite(i)){if(t===i)return z(this.significand+n.significand,t);let s=t-i;return s>0?z(this.significand*J(s)+n.significand,i):z(this.significand+n.significand*J(-s),t)}if(t!==t||i!==i)return e.NAN;let r=!Number.isFinite(t),o=!Number.isFinite(i);return r&&o?this.significand!==n.significand?e.NAN:this.significand>0n?e.POSITIVE_INFINITY:e.NEGATIVE_INFINITY:r?this.significand>0n?e.POSITIVE_INFINITY:e.NEGATIVE_INFINITY:n.significand>0n?e.POSITIVE_INFINITY:e.NEGATIVE_INFINITY}sub(n){typeof n=="number"&&(n=new e(n));let t=this.exponent,i=n.exponent;if(Number.isFinite(t)&&Number.isFinite(i)){if(t===i)return z(this.significand-n.significand,t);let s=t-i;return s>0?z(this.significand*J(s)-n.significand,i):z(this.significand-n.significand*J(-s),t)}if(t!==t||i!==i)return e.NAN;let r=!Number.isFinite(t),o=!Number.isFinite(i);return r&&o?this.significand===n.significand?e.NAN:this.significand>0n?e.POSITIVE_INFINITY:e.NEGATIVE_INFINITY:r?this.significand>0n?e.POSITIVE_INFINITY:e.NEGATIVE_INFINITY:n.significand>0n?e.NEGATIVE_INFINITY:e.POSITIVE_INFINITY}mul(n){typeof n=="number"&&(n=new e(n));let t=this.exponent,i=n.exponent;if(Number.isFinite(t)&&Number.isFinite(i))return z(this.significand*n.significand,t+i);if(t!==t||i!==i||this.significand===0n||n.significand===0n)return e.NAN;let r=this.significand>0n?1n:-1n,o=n.significand>0n?1n:-1n;return r*o>0n?e.POSITIVE_INFINITY:e.NEGATIVE_INFINITY}mulToPrecision(n,t){typeof n=="number"&&(n=new e(n));let i=this.exponent,r=n.exponent,o=this.significand,s=n.significand;if(o!==0n&&s!==0n&&Number.isFinite(i)&&Number.isFinite(r)){let a=o*s,u=i+r,l=this.digitCount()+n.digitCount()-1,f=(a<0n?-a:a)>=J(l)?l+1:l;return f<=t?z(a,u):mu(a,u).roundToPrecKnownDigits(t,f)}return this.mul(n).toPrecision(t)}neg(){let n=this.significand;return n===0n?this:Number.isFinite(this.exponent)?z(-n,this.exponent):n>0n?e.NEGATIVE_INFINITY:e.POSITIVE_INFINITY}abs(){return this.significand>=0n?this:Number.isFinite(this.exponent)?z(-this.significand,this.exponent):e.POSITIVE_INFINITY}floor(){let n=this.exponent;if(n>=0)return this;if(Number.isFinite(n)){let t=this.trunc();return this.significand<0n?t.sub(z(1n,0)):t}return this}ceil(){let n=this.exponent;if(n>=0)return this;if(Number.isFinite(n)){let t=this.trunc();return this.significand>0n?t.add(z(1n,0)):t}return this}round(){let n=this.exponent;if(n>=0)return this;if(Number.isFinite(n)){let t=z(5n,-1);return this.significand>0n?this.add(t).trunc():this.sub(t).trunc()}return this}trunc(){let n=this.exponent;if(n>=0)return this;if(Number.isFinite(n)){let t=this.significand/J(-n);return z(t===0n?0n:t,0)}return this}div(n){typeof n=="number"&&(n=new e(n));let t=this.exponent,i=n.exponent,r=this.significand,o=n.significand;if(Number.isFinite(t)&&Number.isFinite(i)){if(o===0n)return r===0n?e.NAN:r>0n?e.POSITIVE_INFINITY:e.NEGATIVE_INFINITY;if(r===0n)return z(0n,0);let u=e.precision,l=10,c=this.digitCount(),f=n.digitCount(),p=u+l+Math.max(0,f-c),m=J(p),g=r*m/o,y=t-i-p,E=g<0n?-g:g,N=c+p-f,w=E>=J(N)?N+1:N;return mu(g,y).roundToPrecKnownDigits(u,w)}if(t!==t||i!==i)return e.NAN;let s=!Number.isFinite(t),a=!Number.isFinite(i);if(s&&a)return e.NAN;if(s){let u=r>0n?1n:-1n,l=o>0n?1n:o<0n?-1n:1n;return u*l>0n?e.POSITIVE_INFINITY:e.NEGATIVE_INFINITY}return z(0n,0)}inv(){return z(1n,0).div(this)}divToward(n,t){typeof n=="number"&&(n=new e(n));let i=this.exponent,r=n.exponent,o=this.significand,s=n.significand;if(!Number.isFinite(i)||!Number.isFinite(r)||s===0n||o===0n)return this.div(n);let a=o<0n!=s<0n,u=o<0n?-o:o,l=s<0n?-s:s,c=e.precision,p=c+10+Math.max(0,n.digitCount()-this.digitCount()),m=u*J(p),g=m/l,y=m%l!==0n,E=i-r-p,N=this.digitCount()+p-n.digitCount(),w=g>=J(N)?N+1:N,A=a?t==="floor":t==="ceiling",[C,O]=du(g,y,E,c,A,w);return z(a?-C:C,O)}sqrtToward(n){if(this.significand===0n)return this.exponent!==this.exponent?this:e.ZERO;if(!Number.isFinite(this.exponent))return this.significand>0n?e.POSITIVE_INFINITY:e.NAN;if(this.significand<0n)return e.NAN;let t=e.precision,i=4,r=this.significand,o=this.exponent,s=o+this.digitCount()-1,a=Math.floor(s/2),u=t+i-a;o+2*u<0&&(u=Math.ceil(-o/2)+1);let l=o+2*u,c=l>=0?r*J(l):r/J(-l),f=Et(c),p=f*f!==c,[m,g]=du(f,p,-u,t,n==="ceiling");return z(m,g)}mod(n){typeof n=="number"&&(n=new e(n));let t=this.exponent,i=n.exponent;if(Number.isFinite(t)&&Number.isFinite(i)){if(n.significand===0n)return e.NAN;if(this.significand===0n)return z(0n,0);let r=t-i,o=r>=0?this.significand*J(r):this.significand,s=r>=0?n.significand:n.significand*J(-r),a=o/s;return this.sub(z(a,0).mul(n))}return t!==t||i!==i||!Number.isFinite(t)?e.NAN:new e(this)}pow(n){if(typeof n=="number"&&(n=new e(n)),this.isNaN()||n.isNaN()||!n.isFinite())return e.NAN;if(n.isInteger()){let a=n.toBigInt();if(a===0n)return z(1n,0);if(!this.isFinite())return a>0n?this.significand<0n&&a%2n!==0n?e.NEGATIVE_INFINITY:e.POSITIVE_INFINITY:z(0n,0);if(this.isZero())return a>0n?z(0n,0):e.POSITIVE_INFINITY;if(a<0n)return this.pow(n.neg()).inv();let u=this.significand<0n?-this.significand:this.significand,l=this.digitCount(),c=l>15?l-15:0,f=c>0?Number(u/10n**BigInt(c)):Number(u),p=Math.log10(f)+c+this.exponent,m=Number(a)*p;if(m>9e15)return this.significand<0n&&a%2n!==0n?e.NEGATIVE_INFINITY:e.POSITIVE_INFINITY;if(m<-9e15)return z(0n,0);let g=e.precision,y=a.toString(2).length,E=Math.min(2*y+5,100),N=g+E,w=z(1n,0),A=this,C=a;for(;C>0n;)C&1n&&(w=w.mulToPrecision(A,N)),C>>=1n,C>0n&&(A=A.mulToPrecision(A,N));return w.toPrecision(g)}if(!this.isFinite())return this.significand<0n?e.NAN:n.significand>0n?e.POSITIVE_INFINITY:e.ZERO;if(this.isZero())return n.significand>0n?e.ZERO:e.POSITIVE_INFINITY;if(this.significand<0n)return e.NAN;let t=this.exponent+this.digitCount()-1,r=n.exponent+n.digitCount()-1+Math.log10(Math.abs(t)*2.303+3)+1,o=Math.min(20,Math.max(2,Math.ceil(r)+2)),s=e.precision;e.precision=s+o;try{let a=pm(this,s+o);return n.mul(a).exp().toPrecision(s)}finally{e.precision=s}}toNumber(){return Number.isFinite(this.exponent)?this.significand===0n?0:this.exponent===0?Number(this.significand):Number(this.toString()):this.exponent!==this.exponent?NaN:this.significand>0n?1/0:-1/0}toString(){if(!Number.isFinite(this.exponent))return this.exponent!==this.exponent?"NaN":this.significand>0n?"Infinity":"-Infinity";if(this.significand===0n)return"0";let n=this.significand<0n,t=(n?-this.significand:this.significand).toString(),i=t.length,r=i+this.exponent-1,o=n?"-":"";if(r>20||r<-6){let u=i===1?t:t[0]+"."+t.slice(1),l=r>=0?"+":"";return`${o}${u}e${l}${r}`}if(this.exponent>=0)return o+t+"0".repeat(this.exponent);let s=-this.exponent;if(s<i){let u=t.slice(0,i-s),l=t.slice(i-s);return`${o}${u}.${l}`}let a=s-i;return`${o}0.${"0".repeat(a)}${t}`}toFixed(n){let t=n??0;if(!Number.isFinite(this.exponent))return this.exponent!==this.exponent?"NaN":this.significand>0n?"Infinity":"-Infinity";let i=this.significand<0n,r=i?-this.significand:this.significand,o=this.exponent+t,s,a;if(o>=0)a=r===0n,s=a?"0":r.toString()+"0".repeat(o);else{let f=J(-o),p=r/f,m=r%f,g=f/2n,y;m>g?y=p+1n:m<g||f%2n!==0n||p%2n===0n?y=p:y=p+1n,a=y===0n,s=y.toString()}let u=i&&!a?"-":"";if(t===0)return`${u}${s}`;if(s.length<=t){let f=s.padStart(t,"0");return`${u}0.${f}`}let l=s.slice(0,s.length-t),c=s.slice(s.length-t);return`${u}${l}.${c}`}toPrecision(n){if(this.significand===0n||!Number.isFinite(this.exponent))return this;let t=this.digitCount();return t<=n?this:this.roundToPrecKnownDigits(n,t)}roundToPrecKnownDigits(n,t){let i=this.significand<0n?-this.significand:this.significand,r=t-n,o=J(r),s=i/o,a=i-s*o,u=o/2n;(a>u||a===u&&s%2n!==0n)&&(s+=1n);let l=this.significand<0n?-s:s;return z(l,this.exponent+r)}toBigInt(){if(!Number.isFinite(this.exponent))throw this.exponent!==this.exponent?new RangeError("Cannot convert NaN to BigInt"):new RangeError("Cannot convert Infinity to BigInt");if(this.exponent>=0)return this.significand*J(this.exponent);let n=J(-this.exponent);return this.significand/n}},fm=8,Nt=[];function pm(e,n){let t=e.significand,i=e.exponent;for(let o=Nt.length-1;o>=0;o--){let s=Nt[o];if(s.prec===n&&s.exp===i&&s.sig===t)return s.ln}let r=e.ln();return Nt.push({sig:t,exp:i,prec:n,ln:r}),Nt.length>fm&&Nt.shift(),r}function mm(e){let n=e+20+Math.ceil(Math.log10(e+10)),t=h.precision;h.precision=n;try{let i=Math.ceil(n*Math.LN10/4)+5,r=new h(i),o=r.mul(r),s=h.ONE,a=h.ONE,u=h.ZERO,l=h.ZERO,c=h.ONE.div(new h(10).pow(n)),f=6*i+100;for(let p=1;p<=f;p++){let m=new h(p).mul(p);if(s=s.mul(o).div(m).toPrecision(n),l=l.add(h.ONE.div(p)).toPrecision(n),a=a.add(s).toPrecision(n),u=u.add(s.mul(l)).toPrecision(n),p>i&&s.lt(a.mul(c)))break}return u.div(a).sub(r.ln()).toPrecision(e)}finally{h.precision=t}}function z(e,n){let[t,i]=Ei(e,n),r=Object.create(h.prototype);return r.significand=t,r.exponent=i,r}function mu(e,n){let t=Object.create(h.prototype);return t.significand=e,t.exponent=n,t}function du(e,n,t,i,r,o){if(e===0n)return[r&&n?1n:0n,t];let s=o??Yn(e);if(s<=i)return[r&&n?e+1n:e,t];let a=s-i,u=J(a),l=e/u,c=n||e%u!==0n;return r&&c&&(l+=1n),[l,t+a]}var hu=1000000000n,gu=1000n;function Ei(e,n){if(e===0n)return[0n,0];if((e&1n)!==0n)return[e,n];if(e%10n!==0n)return[e,n];for(;e%hu===0n;)e/=hu,n+=9;for(;e%gu===0n;)e/=gu,n+=3;for(;e%10n===0n;)e/=10n,n+=1;return[e,n]}function dm(e){return Number.isNaN(e)?[0n,NaN]:e===1/0?[1n,1/0]:e===-1/0?[-1n,1/0]:Number.isInteger(e)?Ei(BigInt(e),0):bu(e.toString())}function bu(e){if(e=e.trim(),e===""||e==="NaN")return[0n,NaN];if(e==="Infinity"||e==="+Infinity")return[1n,1/0];if(e==="-Infinity")return[-1n,1/0];let n,t=0,i=e.search(/[eE]/);if(i!==-1){if(n=e.slice(0,i),t=Number(e.slice(i+1)),!Number.isFinite(t))return[0n,NaN]}else n=e;let r=!1;n.startsWith("-")?(r=!0,n=n.slice(1)):n.startsWith("+")&&(n=n.slice(1));let o=n.indexOf("."),s,a;o===-1?(s=n,a=""):(s=n.slice(0,o),a=n.slice(o+1)),s=s.replace(/^0+/,"")||"0";let u=s+a;if(u.length===0||!/^\d+$/.test(u))return[0n,NaN];let l=BigInt(u);r&&(l=-l);let c=-a.length;return Ei(l,c+t)}var hm=Math.log2(10),vu=Math.log10(2),gm=16,Wr=1e6;function We(e,n){let t=Math.ceil(n*hm)+gm,i=BigInt(t);return e.exponent>=0?[e.significand*J(e.exponent)<<i,t]:[(e.significand<<i)/J(-e.exponent),t]}function Xe(e,n,t){if(e===0n)return h.ZERO;let i=e<0n,r=i?-e:e,o=BigInt(n),s=Ye(r)-n,a=Math.floor(s*vu),u=t+4-a,l,c;if(u>=0)l=r*J(u)+(1n<<o-1n)>>o,c=-u;else{let p=J(-u)<<o;l=(r+p/2n)/p,c=-u}if(l===0n)return h.ZERO;let f=Yn(l);if(f>t){let p=f-t,m=J(p),g=m/2n,y=l%m;l=l/m,y>=g&&(l+=1n),c+=p}return z(i?-l:l,c)}function ge(e){return e.exponent+e.digitCount()-1}function Yr(e,n){if(e===0n)return 0;let t=e<0n?-e:e,i=n*vu-(Yn(t)-1);return i>0?Math.ceil(i):0}var Eu=5,yu=BigInt(Number.MAX_SAFE_INTEGER),kn=null;function Nu(e){if(kn!==null){if(kn.bits===e)return kn.value;if(kn.bits>e)return kn.value>>BigInt(kn.bits-e)}let n=Hr(10n<<BigInt(e),e);return kn={bits:e,value:n},n}h.prototype.sqrt=function(){if(this.isNaN())return h.NAN;if(this.isZero())return h.ZERO;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:h.NAN;if(this.significand<0n)return h.NAN;let e=h.precision,n=e+10,t=ge(this),i=Math.floor(t/2),r=z(this.significand,this.exponent-2*i),[o,s]=We(r,n),a=yi(o,s),u=Xe(a,s,e);return z(u.significand,u.exponent+i)};h.prototype.cbrt=function(){if(this.isNaN())return h.NAN;if(this.isZero())return h.ZERO;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:h.NEGATIVE_INFINITY;if(this.significand<0n)return this.neg().cbrt().neg();let e=h.precision,n=e+10,t=ge(this),i=Math.floor(t/3),r=z(this.significand,this.exponent-3*i),[o,s]=We(r,n),a=o<<BigInt(2*s),u,l=r.toNumber();if(s<=1e3&&Number.isFinite(l)&&l>0){let p=Number(1n<<BigInt(s)),m=Math.cbrt(l);Number.isFinite(m)&&m>0?(u=BigInt(Math.floor(m*p)),u===0n&&(u=1n)):u=xu(a)}else u=xu(a);let c;do{c=u;let p=u*u;if(p===0n){u=1n;break}u=(2n*u+a/p)/3n}while(Ae(u-c)>1n);{let p=(2n*u+a/(u*u))/3n,m=Ae(u*u*u-a);Ae(p*p*p-a)<m&&(u=p)}let f=Xe(u,s,e);return z(f.significand,f.exponent+i)};h.sqrt=function(e){return e.sqrt()};h.cbrt=function(e){return e.cbrt()};h.prototype.exp=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:h.ZERO;if(this.isZero())return h.ONE;if(ge(this)>=17)return this.significand>0n?h.POSITIVE_INFINITY:h.ZERO;let e=h.precision,n=Math.max(0,this.exponent+this.digitCount()),t=e+20+n,[i,r]=We(this,t),o=Nu(r),s=i/o,a=i-s*o;if(a<0n&&(s-=1n,a+=o),s>yu||s<-yu)return s>0n?h.POSITIVE_INFINITY:h.ZERO;let u=Xe(Ur(a,r),r,e),l=u.exponent+Number(s);return Number.isSafeInteger(l)?z(u.significand,l):s>0n?h.POSITIVE_INFINITY:h.ZERO};h.prototype.ln=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:h.NAN;if(this.isZero())return h.NEGATIVE_INFINITY;if(this.significand<0n)return h.NAN;if(this.eq(1))return h.ZERO;let e=h.precision,n=this.significand,t=this.digitCount(),i=this.exponent+t-1,r=z(n,-(t-1)),o=Math.abs(i).toString().length,s=0;if(i===0||i===-1){let p=this.sub(h.ONE);if(!p.isZero()){let m=ge(p);m<0&&(s=-m)}}let a=e+20+o+s,[u,l]=We(r,a),c=Nu(l),f=Hr(u,l)+BigInt(i)*c;return Xe(f,l,e)};h.prototype.log=function(e){let n=e instanceof h?e:new h(e),t=h.precision;h.precision=t+10;try{return this.ln().div(n.ln()).toPrecision(t)}finally{h.precision=t}};h.exp=function(e){return e.exp()};h.ln=function(e){return e.ln()};h.log10=function(e){return e.log(10)};h.log2=function(e){return e.log(2)};h.prototype.sin=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return h.NAN;if(this.isZero())return h.ZERO;let e=h.precision,n=ge(this);if(n<0&&-2*n>=e+4)return this.toPrecision(e);let t=e+15+(n<0?-n:0);if(n+t+30>Wr)return h.NAN;let[i,r]=We(this,t),[o]=vi(i,r);return Xe(o,r,e)};h.prototype.cos=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return h.NAN;if(this.isZero())return h.ONE;let e=h.precision,n=ge(this),t=0;for(let i=0;;i++){let r=e+15+t;if(n+r+30>Wr)return h.NAN;let[o,s]=We(this,r),[,a]=vi(o,s);if(a===0n){if(i>=3)return h.ZERO;t+=e+30;continue}let u=Yr(a,s);if(u<=t+Eu||i>=3)return Xe(a,s,e);t=u+5}};h.prototype.tan=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return h.NAN;if(this.isZero())return h.ZERO;let e=h.precision,n=ge(this);if(n<0&&-2*n>=e+4)return this.toPrecision(e);let t=n<0?-n:0,i=0;for(let r=0;;r++){let o=e+15+t+i;if(n+o+30>Wr)return h.NAN;let[s,a]=We(this,o),[u,l]=vi(s,a);if(l===0n){if(r>=3)return u>0n?h.POSITIVE_INFINITY:h.NEGATIVE_INFINITY;i+=e+30;continue}let c=Math.max(u===0n?0:Yr(u,a),Yr(l,a));if(c<=i+Eu||r>=3){let f=(u<<BigInt(a))/l;return Xe(f,a,e)}i=c+5}};h.prototype.atan=function(){if(this.isNaN())return h.NAN;if(this.isZero())return h.ZERO;if(!this.isFinite()){let s=h.PI.div(h.TWO);return this.significand>0n?s:s.neg()}let e=h.precision,n=ge(this);if(n<0&&-2*n>=e+4)return this.toPrecision(e);let t=e+15+(n<0?-n:0),[i,r]=We(this,t),o=vt(i,r);return Xe(o,r,e)};h.prototype.asin=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return h.NAN;if(this.isZero())return h.ZERO;let e=this.abs(),n=h.ONE;if(e.gt(n))return h.NAN;if(e.eq(n)){let m=h.PI.div(h.TWO);return this.significand>0n?m:m.neg()}let t=h.precision,i=ge(this);if(i<0&&-2*i>=t+4)return this.toPrecision(t);let r=t+20+(i<0?-i:0),[o,s]=We(this,r),a=1n<<BigInt(s),u=uu(o,o,s),l=a-u,c=yi(l,s),f=lu(o,c,s),p=vt(f,s);return Xe(p,s,t)};h.prototype.acos=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return h.NAN;if(this.abs().gt(h.ONE))return h.NAN;if(this.eq(1))return h.ZERO;if(this.eq(-1))return h.PI;let n=h.precision,t=h.precision;h.precision=n+10;try{let i=h.TWO;if(this.significand>=0n){let o=h.ONE.sub(this).mulToPrecision(h.HALF,n+10).sqrt();return i.mulToPrecision(o.asin(),n)}let r=h.ONE.add(this).mulToPrecision(h.HALF,n+10).sqrt();return h.PI.sub(i.mul(r.asin())).toPrecision(n)}finally{h.precision=t}};h.sin=function(e){return e.sin()};h.cos=function(e){return e.cos()};h.tan=function(e){return e.tan()};h.asin=function(e){return e.asin()};h.acos=function(e){return e.acos()};h.atan=function(e){return e.atan()};h.atan2=function(e,n){let t=e instanceof h?e:new h(e);if(t.isNaN()||n.isNaN())return h.NAN;let i=h.PI,r=i.div(h.TWO);if(n.isZero())return t.isZero()?h.ZERO:t.significand>0n?r:r.neg();let o=t.div(n);return n.significand>0n?o.atan():t.significand>=0n?o.atan().add(i):o.atan().sub(i)};h.prototype.sinh=function(){if(this.isNaN())return h.NAN;if(this.isZero())return h.ZERO;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:h.NEGATIVE_INFINITY;let e=h.precision,n=ge(this);if(n<0){if(-2*n>=e+4)return this.toPrecision(e);let r=h.precision;h.precision=e-n+5;try{let o=this.exp();return o.sub(o.inv()).mulToPrecision(h.HALF,e)}finally{h.precision=r}}if(Math.abs(this.toNumber())>1.16*(e+3)){let r=this.abs().exp().div(h.TWO);return this.significand>0n?r:r.neg()}let t=this.exp(),i=t.inv();return t.sub(i).div(h.TWO)};h.prototype.cosh=function(){if(this.isNaN())return h.NAN;if(this.isZero())return h.ONE;if(!this.isFinite())return h.POSITIVE_INFINITY;let e=h.precision;if(Math.abs(this.toNumber())>1.16*(e+3))return this.abs().exp().div(h.TWO);let n=this.exp(),t=n.inv();return n.add(t).div(h.TWO)};h.prototype.tanh=function(){if(this.isNaN())return h.NAN;if(this.isZero())return h.ZERO;if(!this.isFinite())return this.significand>0n?h.ONE:h.NEGATIVE_ONE;let e=h.precision,n=ge(this);if(n<0){if(-2*n>=e+4)return this.toPrecision(e);let i=h.precision;h.precision=e-n+5;try{let r=this.mul(h.TWO).exp();return r.sub(h.ONE).div(r.add(h.ONE)).toPrecision(e)}finally{h.precision=i}}if(Math.abs(this.toNumber())>1.16*(e+3))return this.significand>0n?h.ONE:h.NEGATIVE_ONE;let t=this.mul(h.TWO).exp();return t.sub(h.ONE).div(t.add(h.ONE))};h.sinh=function(e){return e.sinh()};h.cosh=function(e){return e.cosh()};h.tanh=function(e){return e.tanh()};h.prototype.expm1=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:h.NEGATIVE_ONE;if(this.isZero())return h.ZERO;let e=h.precision,n=ge(this);if(n<0&&-n>=e+2)return this.toPrecision(e);if(n<0){let t=h.precision;h.precision=e-n+5;try{return this.exp().sub(h.ONE).toPrecision(e)}finally{h.precision=t}}return this.exp().sub(h.ONE)};h.prototype.log1p=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:h.NAN;if(this.isZero())return h.ZERO;let e=h.ONE.add(this);if(e.isZero())return h.NEGATIVE_INFINITY;if(e.significand<0n)return h.NAN;let n=h.precision,t=ge(this);if(t<0&&-t>=n+2)return this.toPrecision(n);if(t<0){let i=h.precision;h.precision=n-t+5;try{return h.ONE.add(this).ln().toPrecision(n)}finally{h.precision=i}}return h.ONE.add(this).ln()};h.prototype.asinh=function(){if(this.isNaN())return h.NAN;if(this.isZero())return h.ZERO;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:h.NEGATIVE_INFINITY;let e=this.significand<0n,n=this.abs(),t=h.precision,i=ge(this);if(i<0&&-2*i>=t+4)return this.toPrecision(t);let r=()=>n.add(n.mul(n).add(h.ONE).sqrt()).ln(),o;if(i<0){let s=h.precision;h.precision=t-i+5;try{o=r().toPrecision(t)}finally{h.precision=s}}else o=r();return e?o.neg():o};h.prototype.acosh=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:h.NAN;if(this.lt(h.ONE))return h.NAN;if(this.eq(1))return h.ZERO;let e=this.sub(h.ONE).div(h.TWO).sqrt();return h.TWO.mul(e.asinh())};h.prototype.atanh=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return h.NAN;if(this.isZero())return h.ZERO;let e=this.abs();if(e.eq(1))return this.significand>0n?h.POSITIVE_INFINITY:h.NEGATIVE_INFINITY;if(e.gt(h.ONE))return h.NAN;let n=h.precision,t=ge(this);if(-2*t>=n+4)return this.toPrecision(n);let i=h.precision;h.precision=n-t+5;try{return h.ONE.add(this).div(h.ONE.sub(this)).ln().mulToPrecision(h.HALF,n)}finally{h.precision=i}};h.prototype.nthRoot=function(e){if(this.isNaN()||!Number.isInteger(e)||e===0)return h.NAN;if(e===1)return this;if(e===2)return this.sqrt();if(e===3)return this.cbrt();if(e<0)return this.nthRoot(-e).inv();if(this.isZero())return h.ZERO;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:e%2===0?h.NAN:h.NEGATIVE_INFINITY;if(this.significand<0n)return e%2===0?h.NAN:this.neg().nthRoot(e).neg();let n=h.precision,t=h.precision;h.precision=n+8;try{return h.exp(this.ln().div(new h(e))).toPrecision(n)}finally{h.precision=t}};h.asinh=function(e){return e.asinh()};h.acosh=function(e){return e.acosh()};h.atanh=function(e){return e.atanh()};h.expm1=function(e){return e.expm1()};h.log1p=function(e){return e.log1p()};h.nthRoot=function(e,n){return e.nthRoot(n)};function xu(e){let n=Ye(e);if(n<=1023){let u=Math.cbrt(Number(e));if(Number.isFinite(u)&&u>=1)return BigInt(Math.floor(u))}let t=n-51,i=Number(e>>BigInt(t)),r=Math.cbrt(i),o=Math.floor(t/3),s=t%3;s===1&&(r*=1.2599210498948732),s===2&&(r*=1.5874010519681994);let a=BigInt(Math.round(r))<<BigInt(o);return a>0n?a:1n}var P1=1n<<32n;var D1=[BigInt(4),BigInt(2),BigInt(4),BigInt(2),BigInt(4),BigInt(6),BigInt(2),BigInt(6)];var bm=53,Tu=Math.floor(Math.log10(Math.pow(2,bm))),ym=1e-10,we=1e6;var Wn=1e4;function An(e,n){if(e===0)return n;if(n===0||e===n)return e;if(!Number.isInteger(e)||!Number.isInteger(n))return NaN;for(;n!==0;)[e,n]=[n,e%n];return e<0?-e:e}function _t(e,n){if(e===0||n===0)return 0;let t=BigInt(e)*BigInt(n)/BigInt(An(e,n));return t<0n&&(t=-t),Number(t)}function It(e){if(!Number.isInteger(e)||e<0)return NaN;if(e>=170)return 1/0;let n=1;for(let t=2;t<=e;t++)n=n*t;return n}function St(e){if(!Number.isInteger(e)||e<0)return NaN;if(e<0)return NaN;if(e<=1)return 1;let n=e;for(;e>2;)e-=2,n*=e;return n}function wt(e,n=ym){return typeof e=="number"&&Math.abs(e)<=n?0:e}function xm(e,n,t){let o=!Number.isFinite(n),s=m=>o?1/m:n+m,a=(m,g,y)=>{let E=.01*Math.max(1,Math.abs(y));for(let N=1;N<=5;N++){let w=e(s(m*Math.pow(g/m,N/6)));if(!Number.isFinite(w)||Math.abs(w-y)>E)return!1}return!0},u=o?1/t:t,l=0,c=!1,f=NaN,p=NaN;for(let m=1;m<=60;m++){let g=e(s(u));if(!Number.isFinite(g))return m-1;let y=Math.abs(g);if(m===1){l=y,f=y,p=u,u*=.125;continue}if(Math.abs(y-f)<=1e-10*Math.max(1,y))return a(p,u,g)?1/0:0;if(c&&l>1e-6&&y<1e-8*l)return m-1;y>l&&(c=!0,l=y),f=y,p=u,u*=.125}return 1/0}function Ni(e,n,t=1,i){if(t===0){let u=Ni(e,n,-1,i),l=Ni(e,n,1,i);return u===void 0||l===void 0?NaN:Math.abs(u-l)>1e-5?NaN:(u+l)/2}let r=t>0?1:-1,o=xm(e,n,r);if(o===0)return NaN;let[s,a]=Jr(e,n,{step:r,deadline:i,...Number.isFinite(o)?{maxeval:o}:{}});return Number.isFinite(s)&&a>1e-6*Math.max(1,Math.abs(s))?NaN:s}var Ti=["number","finite_number","complex","finite_complex","imaginary","real","finite_real","rational","finite_rational","integer","finite_integer","non_finite_number"],Xr=["indexed_collection","list","tuple"],_i=[...Xr,"collection","set","record","dictionary"],Ii=["scalar",...Ti,"boolean","string"],Qr=["value","color",..._i,...Ii],Kr=["expression","symbol","function",...Qr],eo=["any","unknown","nothing","never","error",...Kr],Xn=new Set(Ti),_u=new Set(_i),Iu=new Set(Ii),Cn=new Set(eo);function Su(e){return typeof e!="string"?!1:Cn.has(e)}function Si(e){return typeof e=="string"?Cn.has(e):typeof e!="object"||!("kind"in e)?!1:e.kind==="signature"||e.kind==="union"||e.kind==="intersection"||e.kind==="negation"||e.kind==="value"||e.kind==="tuple"||e.kind==="list"||e.kind==="record"||e.kind==="dictionary"||e.kind==="set"||e.kind==="symbol"||e.kind==="expression"||e.kind==="numeric"||e.kind==="collection"||e.kind==="indexed_collection"||e.kind==="reference"}var wi=class{input;pos=0;line=1;column=1;tokens=[];tolerant;constructor(n,t){this.input=n,this.tolerant=t?.tolerant??!1}saveState(){return{pos:this.pos,line:this.line,column:this.column,tokens:[...this.tokens]}}restoreState(n){this.pos=n.pos,this.line=n.line,this.column=n.column,this.tokens=n.tokens}error(n){throw new Error(`Lexer error at line ${this.line}, column ${this.column}: ${n}`)}peek(n=0){let t=this.pos+n;return t<this.input.length?this.input[t]:""}advance(){let n=this.input[this.pos++];return n===`
|
|
4
4
|
`?(this.line++,this.column=1):this.column++,n}match(n){if(this.input.slice(this.pos,this.pos+n.length)===n){for(let t=0;t<n.length;t++)this.advance();return!0}return!1}isEOF(){return this.pos>=this.input.length}skipWhitespace(){for(;!this.isEOF()&&/\s/.test(this.peek());)this.advance()}readIdentifier(){let n="";for(;!this.isEOF()&&/[a-zA-Z0-9_]/.test(this.peek());)n+=this.advance();return n}readVerbatimString(){if(!this.match("`"))return"";let n="";for(;!this.isEOF()&&this.peek()!=="`";)this.match("\\`")?n+="`":this.match("\\\\")?n+="\\":n+=this.advance();return this.isEOF()&&this.error("Unterminated verbatim string"),this.advance(),n}readStringLiteral(){let n=this.advance(),t="";for(;!this.isEOF()&&this.peek()!==n;)this.match("\\"+n)?t+=n:this.match("\\\\")?t+="\\":t+=this.advance();return this.isEOF()&&this.error("Unterminated string literal"),this.advance(),t}readNumber(){let n="";if((this.peek()==="-"||this.peek()==="+")&&(n+=this.advance()),this.match("0x")||this.match("0X")){for(n+="x";!this.isEOF()&&/[0-9a-fA-F]/.test(this.peek());)n+=this.advance();return"0"+n}if(this.match("0b")||this.match("0B")){for(n+="b";!this.isEOF()&&/[01]/.test(this.peek());)n+=this.advance();return"0"+n}for(;!this.isEOF()&&/[0-9]/.test(this.peek());)n+=this.advance();if(this.peek()==="."&&/[0-9]/.test(this.peek(1)))for(n+=this.advance();!this.isEOF()&&/[0-9]/.test(this.peek());)n+=this.advance();if(this.peek()==="e"||this.peek()==="E")for(n+=this.advance(),(this.peek()==="+"||this.peek()==="-")&&(n+=this.advance());!this.isEOF()&&/[0-9]/.test(this.peek());)n+=this.advance();return n}createToken(n,t){return{type:n,value:t,position:this.pos-t.length,line:this.line,column:this.column-t.length}}nextToken(){if(this.skipWhitespace(),this.isEOF())return this.createToken("EOF","");let n=this.pos,t=this.peek();if(this.match("->"))return this.createToken("->","->");if(this.match(".."))return this.createToken("..","..");if(this.match("+\u221E")||this.match("+oo"))return this.createToken("PLUS_INFINITY",this.input.slice(n,this.pos));if(this.match("-\u221E")||this.match("-oo"))return this.createToken("MINUS_INFINITY",this.input.slice(n,this.pos));if(this.match("+infinity"))return this.createToken("PLUS_INFINITY","+infinity");if(this.match("-infinity"))return this.createToken("MINUS_INFINITY","-infinity");if(/[a-zA-Z_]/.test(t)){let i=this.readIdentifier();switch(i){case"true":return this.createToken("TRUE",i);case"false":return this.createToken("FALSE",i);case"nan":return this.createToken("NAN",i);case"infinity":return this.createToken("INFINITY",i);case"oo":return this.createToken("INFINITY",i);default:return this.createToken("IDENTIFIER",i)}}switch(t){case"|":return this.advance(),this.createToken("|","|");case"&":return this.advance(),this.createToken("&","&");case"!":return this.advance(),this.createToken("!","!");case"^":return this.advance(),this.createToken("^","^");case"(":return this.advance(),this.createToken("(","(");case")":return this.advance(),this.createToken(")",")");case"<":return this.advance(),this.createToken("<","<");case">":return this.advance(),this.createToken(">",">");case"[":return this.advance(),this.createToken("[","[");case"]":return this.advance(),this.createToken("]","]");case",":return this.advance(),this.createToken(",",",");case":":return this.advance(),this.createToken(":",":");case"?":return this.advance(),this.createToken("?","?");case"*":return this.advance(),this.createToken("*","*");case"+":return/[0-9]/.test(this.peek(1))?this.createToken("NUMBER_LITERAL",this.readNumber()):(this.advance(),this.createToken("+","+"));case"x":return/[0-9]/.test(this.peek(1))?(this.advance(),this.createToken("x","x")):(this.advance(),this.createToken("x","x"))}if(t==='"'||t==="'")return this.createToken("STRING_LITERAL",this.readStringLiteral());if(t==="`")return this.createToken("VERBATIM_STRING",this.readVerbatimString());if(/[0-9]/.test(t)||t==="-"&&/[0-9]/.test(this.peek(1))){let i=this.readNumber();return this.peek()==="x"&&/[0-9]/.test(this.peek(1)),this.createToken("NUMBER_LITERAL",i)}if(t==="\u221E")return this.advance(),this.createToken("INFINITY","\u221E");if(this.tolerant)return this.createToken("EOF","");this.error(`Unexpected character: ${t}`)}tokenize(){let n=[];for(;!this.isEOF();){let t=this.nextToken();if(t&&(n.push(t),t.type==="EOF"))break}return n}peekToken(){if(this.tokens.length===0){let n=this.nextToken();n&&this.tokens.push(n)}return this.tokens[0]||this.createToken("EOF","")}consumeToken(){if(this.tokens.length===0){let n=this.nextToken();if(n)return n}return this.tokens.shift()||this.createToken("EOF","")}matchToken(n){return this.peekToken().type===n?(this.consumeToken(),!0):!1}expectToken(n){let t=this.consumeToken();return t.type!==n&&this.error(`Expected ${n}, got ${t.type}`),t}};var Mi=class{lexer;typeResolver;current;allowTrailing;_end=0;constructor(n,t){this.allowTrailing=t?.allowTrailing??!1,this.lexer=new wi(n,{tolerant:this.allowTrailing}),this.typeResolver=t?.typeResolver??{forward:()=>{},resolve:()=>{},get names(){return[]}},this.current=this.lexer.consumeToken()}get endOffset(){return this._end}error(n,t){this.errorAtToken(this.current,n,t)}errorAtToken(n,t,i){let r=this.lexer.input;this.allowTrailing&&(r=r.slice(0,n.position+n.value.length));let s=r.split(`
|
|
@@ -1744,7 +1744,7 @@ vec2 _iv_mod(vec2 a, vec2 b) {
|
|
|
1744
1744
|
}
|
|
1745
1745
|
`;function zp(e={}){let n=e.trigAbsPad??0;return g1.replace("__IV_TRIG_ABS__",Ne(n))}var h5=zp(),Jp={Add:(e,n)=>{if(e.length===0)return"vec2(0.0, 0.0)";let t=n(e[0]);for(let i=1;i<e.length;i++)t=`_iv_add(${t}, ${n(e[i])})`;return t},Subtract:([e,n],t)=>{if(e===null||n===null)throw new Error("Subtract: missing argument");return`_iv_sub(${t(e)}, ${t(n)})`},Multiply:(e,n)=>{if(e.length===0)return"vec2(1.0, 1.0)";let t=n(e[0]);for(let i=1;i<e.length;i++)t=`_iv_mul(${t}, ${n(e[i])})`;return t},Divide:([e,n],t)=>{if(e===null||n===null)throw new Error("Divide: missing argument");return`_iv_div(${t(e)}, ${t(n)})`},Negate:([e],n)=>{if(e===null)throw new Error("Negate: no argument");return`_iv_negate(${n(e)})`},Square:([e],n)=>{if(e===null)throw new Error("Square: no argument");return`_iv_square(${n(e)})`},Sqrt:([e],n)=>{if(e===null)throw new Error("Sqrt: no argument");return`_iv_sqrt(${n(e)})`},Abs:([e],n)=>{if(e===null)throw new Error("Abs: no argument");return`_iv_abs(${n(e)})`},Exp:([e],n)=>{if(e===null)throw new Error("Exp: no argument");return`_iv_exp(${n(e)})`},Ln:([e],n)=>{if(e===null)throw new Error("Ln: no argument");return`_iv_ln(${n(e)})`},Log:(e,n)=>e.length===1?`_iv_log10(${n(e[0])})`:`_iv_div(_iv_ln(${n(e[0])}), _iv_ln(${n(e[1])}))`,Lb:([e],n)=>{if(e===null)throw new Error("Lb: no argument");return`_iv_log2(${n(e)})`},Sin:([e],n)=>{if(e===null)throw new Error("Sin: no argument");return`_iv_sin(${n(e)})`},Cos:([e],n)=>{if(e===null)throw new Error("Cos: no argument");return`_iv_cos(${n(e)})`},Tan:([e],n)=>{if(e===null)throw new Error("Tan: no argument");return`_iv_tan(${n(e)})`},Arcsin:([e],n)=>{if(e===null)throw new Error("Arcsin: no argument");return`_iv_asin(${n(e)})`},Arccos:([e],n)=>{if(e===null)throw new Error("Arccos: no argument");return`_iv_acos(${n(e)})`},Arctan:([e],n)=>{if(e===null)throw new Error("Arctan: no argument");return`_iv_atan(${n(e)})`},Floor:([e],n)=>{if(e===null)throw new Error("Floor: no argument");return`_iv_floor(${n(e)})`},Ceil:([e],n)=>{if(e===null)throw new Error("Ceil: no argument");return`_iv_ceil(${n(e)})`},Round:([e],n)=>{if(e===null)throw new Error("Round: no argument");return`_iv_round(${n(e)})`},Truncate:([e],n)=>{if(e===null)throw new Error("Truncate: no argument");return`_iv_trunc(${n(e)})`},Fract:([e],n)=>{if(e===null)throw new Error("Fract: no argument");return`_iv_fract(${n(e)})`},Sign:([e],n)=>{if(e===null)throw new Error("Sign: no argument");return`_iv_sign(${n(e)})`},Heaviside:([e],n)=>{if(e===null)throw new Error("Heaviside: no argument");return`_iv_heaviside(${n(e)})`},Mod:([e,n],t)=>{if(e===null||n===null)throw new Error("Mod: missing argument");return`_iv_mod(${t(e)}, ${t(n)})`},Min:(e,n)=>{if(e.length===0)throw new Error("Min: no argument");let t=n(e[0]);for(let i=1;i<e.length;i++)t=`_iv_min(${t}, ${n(e[i])})`;return t},Max:(e,n)=>{if(e.length===0)throw new Error("Max: no argument");let t=n(e[0]);for(let i=1;i<e.length;i++)t=`_iv_max(${t}, ${n(e[i])})`;return t},Power:([e,n],t)=>{if(e===null||n===null)throw new Error("Power: missing argument");if(T(e,"ExponentialE"))return`_iv_exp(${t(n)})`;if(P(n)&&n.im===0){let i=n.re;if(i===.5)return`_iv_sqrt(${t(e)})`;if(i===2)return`_iv_square(${t(e)})`;if(Number.isInteger(i)&&i>=0)return`_iv_powi(${t(e)}, ${Ne(i)})`;if(!Number.isInteger(i)&&i>0){let r=n.numerator?.re,o=n.denominator?.re;return Number.isInteger(r)&&Number.isInteger(o)&&o>1&&o%2!==0?`_iv_powrat(${t(e)}, ${Ne(r)}, ${Ne(i)})`:`_iv_powf(${t(e)}, ${Ne(i)})`}throw new Error(`interval-glsl: Power with exponent \`${n.toString()}\` is not yet supported`)}throw new Error("interval-glsl: Power with a variable exponent is not yet supported")}},Lr={Pi:"vec2(3.14159265359, 3.14159265359)",ExponentialE:"vec2(2.71828182846, 2.71828182846)",GoldenRatio:"vec2(1.61803398875, 1.61803398875)",CatalanConstant:"vec2(0.91596559417, 0.91596559417)",EulerGamma:"vec2(0.57721566490, 0.57721566490)"},Br=class extends gt{languageId="interval-glsl";getOperators(){return{}}getFunctions(){return Jp}getConstants(){return Lr}createTarget(n={}){return super.createTarget({operators:()=>{},functions:t=>Jp[t],number:t=>`vec2(${Ne(t)}, ${Ne(t)})`,complex:()=>{throw new Error("interval-glsl: complex values are not supported")},var:t=>Lr[t],...n})}getPreamble(n={}){return zp(n)}compile(n,t={}){let{vars:i,trigAbsPad:r}=t,o=this.createTarget({var:u=>{if(i&&u in i)return i[u];if(u in Lr)return Lr[u]}}),s=x.compile(n,o),a=x.withReferences({target:"interval-glsl",success:!0,code:s},n,o,i?new Set(Object.keys(i)):void 0);return(s.includes("_iv_")||(a.freeSymbols?.length??0)>0)&&(a.preamble=this.getPreamble({trigAbsPad:r})),a}compileExclusionShader(n,t={}){let{version:i="300 es",precision:r="highp",trigAbsPad:o}=t,s=this.compile(n),a=s.freeSymbols??[];if(a.length>2)throw new Error(`interval-glsl exclusion shader supports at most 2 free variables (got ${a.length}: ${a.join(", ")})`);let u=a.map(m=>`vec2 ${m}`).join(", "),[l,c]=a,f=["void main() {"];f.push(" vec2 _cell = gl_FragCoord.xy / u_resolution;"),f.push(" vec2 _step = 1.0 / u_resolution;");let p=[];return l!==void 0&&(f.push(" float _xlo = mix(u_domainX.x, u_domainX.y, _cell.x);"),f.push(" float _xhi = mix(u_domainX.x, u_domainX.y, _cell.x + _step.x);"),f.push(" float _xext = max(abs(u_domainX.x), abs(u_domainX.y));"),p.push("_iv_widen_box(vec2(_xlo, _xhi), _xext)")),c!==void 0&&(f.push(" float _ylo = mix(u_domainY.x, u_domainY.y, _cell.y);"),f.push(" float _yhi = mix(u_domainY.x, u_domainY.y, _cell.y + _step.y);"),f.push(" float _yext = max(abs(u_domainY.x), abs(u_domainY.y));"),p.push("_iv_widen_box(vec2(_ylo, _yhi), _yext)")),f.push(` vec2 _f = _implicit(${p.join(", ")});`),f.push(" bool _excluded = (_f.x > 0.0 || _f.y < 0.0);"),f.push(" fragColor = _excluded ? vec4(0.0, 0.0, 0.0, 1.0) : vec4(1.0);"),f.push("}"),[`#version ${i}`,`precision ${r} float;`,"",this.getPreamble({trigAbsPad:o}).trim(),"","uniform vec2 u_domainX; // [min, max] for the 1st free variable","uniform vec2 u_domainY; // [min, max] for the 2nd free variable","uniform vec2 u_resolution; // render target size, in pixels","","out vec4 fragColor;","","// Interval evaluation of the implicit field f over a cell box. The box is","// outward-rounded by the caller (main(), via _iv_widen_box).",`vec2 _implicit(${u}) {`,` return ${s.code};`,"}","",f.join(`
|
|
1746
1746
|
`),""].join(`
|
|
1747
|
-
`)}};var b1="0.69.
|
|
1747
|
+
`)}};var b1="0.69.1";return Wp(y1);})();
|
|
1748
1748
|
/*! Bundled license information:
|
|
1749
1749
|
|
|
1750
1750
|
complex-esm/dist/src/complex.js:
|
package/dist/compile.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Compile 0.69.
|
|
1
|
+
/** Compile 0.69.1 */
|
|
2
2
|
(function(global,factory){typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'],factory):(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Compile = {}));})(this, (function (exports) { 'use strict';
|
|
3
3
|
"use strict";
|
|
4
4
|
var Compile = (() => {
|
|
@@ -36335,7 +36335,7 @@ vec2 _iv_mod(vec2 a, vec2 b) {
|
|
|
36335
36335
|
};
|
|
36336
36336
|
|
|
36337
36337
|
// src/compile.ts
|
|
36338
|
-
var version = "0.69.
|
|
36338
|
+
var version = "0.69.1";
|
|
36339
36339
|
return __toCommonJS(compile_exports);
|
|
36340
36340
|
})();
|
|
36341
36341
|
/*! Bundled license information:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Compute Engine 0.69.
|
|
1
|
+
/** Compute Engine 0.69.1 */
|
|
2
2
|
import {
|
|
3
3
|
BigDecimal,
|
|
4
4
|
BigNumericValue,
|
|
@@ -227,7 +227,7 @@ import {
|
|
|
227
227
|
wildcardType,
|
|
228
228
|
withAmbientDeadline,
|
|
229
229
|
zip
|
|
230
|
-
} from "./chunks/chunk-
|
|
230
|
+
} from "./chunks/chunk-TWCY5EYT.js";
|
|
231
231
|
|
|
232
232
|
// src/common/utils.ts
|
|
233
233
|
var MAX_PERMUTATION_ELEMENTS = 6;
|
|
@@ -66640,14 +66640,14 @@ var ComputeEngine = class _ComputeEngine {
|
|
|
66640
66640
|
_setDefaultEngineFactory(() => new ComputeEngine());
|
|
66641
66641
|
|
|
66642
66642
|
// src/compute-engine.ts
|
|
66643
|
-
var version = "0.69.
|
|
66643
|
+
var version = "0.69.1";
|
|
66644
66644
|
ComputeEngine._latexSyntaxFactory = () => new LatexSyntax();
|
|
66645
66645
|
_setDefaultEngineFactory(
|
|
66646
66646
|
() => new ComputeEngine({ latexSyntax: new LatexSyntax() })
|
|
66647
66647
|
);
|
|
66648
66648
|
globalThis[/* @__PURE__ */ Symbol.for("io.cortexjs.compute-engine")] = {
|
|
66649
66649
|
ComputeEngine: ComputeEngine.prototype.constructor,
|
|
66650
|
-
version: "0.69.
|
|
66650
|
+
version: "0.69.1"
|
|
66651
66651
|
};
|
|
66652
66652
|
export {
|
|
66653
66653
|
DEFINITIONS_ALGEBRA as ALGEBRA_DICTIONARY,
|